crypto-trading-bot icon indicating copy to clipboard operation
crypto-trading-bot copied to clipboard

Enable short/long trades without exit of open trade

Open egisz opened this issue 4 years ago • 4 comments

Tradingview allows strategies to switch long/short without exit of current position. This update allow same thing. It checks if there is open position, then if we want to switch from side, it adds position amount to calculated order size. This works on Bitfinex, have not tested on other exchanges.

I had doupts if this should be added directly in executeOrder method, or in CalculateOrderSize. But was bit afraid to touch it.

egisz avatar Apr 22 '20 09:04 egisz

i will implement it in a more generic way. So simply by just adding and removing a given "amount". So the idea would be to store the current position size (or 0 on none) and the difference must be bought or sold.

By this is possible to have targets, profits and multiple entries, also your use case would be directly possible

Haehnchen avatar Apr 24 '20 14:04 Haehnchen

Hi @Haehnchen, do you have some ETA for this feature? It's bit annoying to keep this as separate branch and merge into prod :)

egisz avatar Nov 26 '20 21:11 egisz

@egisz how it will be implemented in strategy? something like if(lastSignal = "short" ) { signal = "long"} (lastSignal = "long" ) { signal = "short"} ?

gelinger777 avatar Jan 17 '21 13:01 gelinger777

@egisz how it will be implemented in strategy? something like if(lastSignal = "short" ) { signal = "long"} (lastSignal = "long" ) { signal = "short"} ?

Hi, it's not required to check last signal, it will trade only if last signal != current signal. You can simply skip "close" signal and directly go from short to long and vice versa.

egisz avatar Apr 19 '21 10:04 egisz