I want to know how can I close a position when indicator do something. For example a SMA(5) cross SMA(34).
I know that I can do it using OnBarUpdate() method, but I am not sure how can I send a signal or something like that to exit using OnExecutionUpdate(). I just only did it with fixed targets and stop but not by a condition like a SMA crossing.
In this line of this sample shows a position entering and exit until reach a number of ticks:
stopOrder = ExitLongStopMarket(0, true, 1, execution.Price - 20 * TickSize, "stop", "long limit entry");
targetOrder = ExitLongLimit(0, true, 1, execution.Price + 40 * TickSize, "target", "long limit entry");
but what would happen if I want to close a position when indicator do something?
Link
https://ninjatrader.com/support/help...lOrder_NT8.zip

Comment