What you can do is - calculate a middle point btw the long and short price and below it issue a long limit and cancel short limit, if was issued, and vs. On the next bar if was not triggered recalculate.
The following user says Thank You to baruchs for this post:
This is an interesting post and would like to add the following. Hopefully someone has found a good solution for the following.
shortlimit is active
longlimit becomes active
NT will ignore the longlimit in the managed approach because of the trading rules.
cancel shortlimit first
then activate longlimit
if you put this code close to each other the Nt core will not have enough time to cancel the shortlimit and you end up again with the ignored longlimit.
There needs to be at least one bar in between the cancel of shortlimit and the activation of longlimit.
So you will have to cancel shortlimit on bar 0 and activate longlimit on bar 1
problem: you activate 1 bar too late with possible missed trading opportunities
use smaller time frame to cancel the shortlimit on bar 0 and activate the longlimit 1 bar later on the smaller timeframe. Use the other logic on you regular timeframe.
this will make your overall performance slower, for example i am running into crashing NT during WFO because i am using lower time frame (1 minute) for 0 bar cancelling and 1 bar later activating. At the same time the main logic of the code is still running on the higher time frame.
Did anyone find a solution for this.
Maybe it is time to step to the unmanaged approach?