Rules of the forum are written in bold and in the yellow box just above the text editor when you write a post, please respect them. Thank you.
At line 35 of your code, you must use SELLSHORT to initiate a new sell order, SELL instruction is made to close long orders.
Same for line 40, use EXITSHORT to close a short position.
Thanks Nicolas, but now I don’t get it to take any positions at all..? Am I doing it all wrong?
Sorry to waste your time on trivialities!
Should work if you only changed the lines 35 and 40.
I played about with it after I got no trades (even after Nicolas change) then I got it to trade but was a ‘oblique path to doom’ (looked like all losers?) then I reversed the buy sellshort conditions (as a quick look see) but still not good.
Then I started to change the code and got trades on Daily TF and 4 Hours, but was still looking way out so I abandoned it.
I reckon you should comment out all except 1 entry and 1 exit condition and get it trading and then uncomment more … making only 1 change at a time?
Please post results as I may get back into it at some stage?
GraHal
You can test each variable with the GRAPH instruction while backtesting, that way you’ll get a better view of what’s not working:
Just add these lines at the end of the code and launch a backtest.
graph longentry as "long entry"
graph shortentry as "short entry"
If a variable is true, then it should be equal to 1, and a new order should be initiated as per your conditions.