Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable short/long trades without exit of open trade #117

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

egisz
Copy link
Contributor

@egisz egisz commented Apr 22, 2020

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.

@Haehnchen
Copy link
Owner

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

@egisz
Copy link
Contributor Author

egisz commented Nov 26, 2020

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

@gelinger777
Copy link

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

@egisz
Copy link
Contributor Author

egisz commented Apr 19, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants