I have a problem with Ninja trader ignoring the Take profit which are pre-entered as limit orders for a custom strategy. The function used are ExitLongLimit or ExitShortLimit Stop loss orders are created using ExitLongStop and ExitShortStop.
All Exit functions are called with liveUntilCancelled parameter set to true.
The strategy trades 3 lots and has 3 individual profit targets which are all limit orders.
In most cases, when Target 1 (T1) limit is reached, it gets filled.
However, the limit orders for Targets 2 and 3 get ignored and are never filled even when price reaches and exceeds well above (or below) the preset limit.
Price trades right through the limit order levels and the limit order obviously doesn't get filled.
Trades do eventually exit because the strategy does also have few other exit criterias (auxiliary exits) built into it. All this auxiliary exits are executed using at-market exit functions at which point, the strategy does cancel the unfilled and redundant Target and stop loss orders.
This does not always result in trade loss. In case of one short order, the T3 limit price was set at 93.4 and trade was actually exited at 93.25. While the overall outcome is favorable, my concern is more to do with the function not behaving as expected. The problem is strictly confined to Exit...Limit failing to get filled as required.
One interesting observation that is perhaps relevant is that this only happens on trades where the average price is more than 2 decimal places. Since the strategy is trading CL, if it gets a fill for the 3 lots at the same price, say 94.55, it works fine.
But if it gets filled 2 lots at 94.55 and 1 lot at 94.56, the average price is 94.55333. These are the only trades that cause this problem.
I don't know whether this has anything to do with it but I have taken over 50 trades and this pattern holds up so I suspect it may offer a clue.
Every time the average price is 2 decimal places it works perfectly and every time it has more than 2 decimal places the limit orders are getting ignored.
I would appreciate any help.
Thanks

Comment