I want to exit trades which have been open for >9 bars.
(Therefore, no trade will be longer than 10 bars)
E.g. If trade has been open >9 bars since signal, exit position.
What code do I use to get the result?
Where do I put the code? Under Initialize() or OnBarUpdate() ?
Would also be grateful if you showed how I enter a trade if 3 bars have elapsed after a signal has been made.
E.g. If it has been 5 bars since Close > SMA, enter Long.
And If it has been 5 bars since Close < SMA, enter Short.
Comment