After you add contracts to a trade (a scale-in) on a stop and target bracket whose target has already partly filled, the stop can end up smaller than the position. This is NinjaTrader's own bracket (OCO) behavior, on the leader and on the followers, and Replikanto cannot keep a larger stop in this case.
What you see
- After a scale-in, the stop covers fewer contracts than the open position, so some contracts have no stop.
- It is most likely on a follower with a Ratio of 2 or more, and on the leader after a scale-in of 2 or more contracts.
- A stop you raise by hand can shrink again at the target's next event.
Why it happens
While a bracket is working, NinjaTrader resizes each leg itself. On every event of a leg that has a fill (a new fill, or a change of that leg's price or quantity), NinjaTrader sets the other leg to:
the smaller of (the largest size this leg ever had) and (the largest size the other leg ever had + 1), minus this leg's fills
When the stop and target were created with the same size and the target is never raised more than 1 above the stop, this gives the expected result: the stop equals the original target minus the fills. After a scale-in, the "+ 1" caps the stop. NinjaTrader never raises a leg above the largest size it ever had; only you can.
A follower's NinjaTrader applies the same rule to the follower's own bracket, with the follower's own fills. Replikanto cannot keep a larger stop there: NinjaTrader resizes it again at the target's next event.
Examples (measured on Sim accounts)
- Leader, target raised by 2 at once. A bracket of 30 has 1 contract of its target filled, so the stop is 29. The target is raised to 32: NinjaTrader takes the stop only to 30, and no further even if the target goes to 34 or 38.
- Follower with Ratio 2. The leader has 3 contracts of its target filled, scales in by 1 and raises the target and the stop by 1, so the leader stays covered. The follower, with 10 contracts of its target filled, gets its target raised from 60 to 62 and its position from 50 to 52. The follower's NinjaTrader sets the stop to 51, leaving 1 contract without a stop.
- Stop raised above its largest size. If you raise the stop above the largest size it ever had (for example from 30 to 31 on a bracket created with 30), the cap rises with it.
What to do
- After a scale-in on a bracket whose target has partly filled, check the stop size on the leader and on each follower.
- If the stop must cover the whole position, cancel the bracket and send a new one sized to the position. A new bracket starts from zero, without the history that caps the stop.
- Follower Guard compares position and direction, not stop size, so it does not warn about this case.
Good to know
- This was measured on Sim accounts, where NinjaTrader itself manages the OCO. A broker that holds the OCO on its own side may behave differently.
- Starting with Replikanto 1.7.0.0, a change you make to the quantity of the leader's stop or target after a partial fill is copied to followers that do not use ATM Copy. The resize NinjaTrader makes on its own is not copied, because the follower's NinjaTrader makes its own. See Does moving the leader's stop or target update the followers?
Comments
0 comments
Article is closed for comments.