This article explains why NinjaTrader can keep showing a Rithmic account in a position that the broker (RTrader Pro) has already closed, or miss a fill and show the account flat while the broker still holds a position; why flattening that "phantom" (ghost, stale) position can open a real inverted trade; and what Replikanto does about it starting with Replikanto 1.7.0.0. It applies to any account on a Rithmic connection in NinjaTrader, including prop-firm accounts such as Apex and Topstep.
What is happening
NinjaTrader keeps its own copy of each account's position. On a Rithmic connection that copy can fall behind the broker: after a position closes, NinjaTrader keeps showing it as open, or it misses a fill and shows the account flat while the broker holds a position. RTrader Pro shows the real position; NinjaTrader shows an old one.
The damage happens when something tries to close the phantom position. Flatten All, a follower's Flatten button or Follower Guard sends a closing order for a position that no longer exists at the broker, so that "close" order opens a brand-new position in the opposite direction. This is the typical report "Flatten All opened a position" or "my follower was inverted after a flatten".
The cause: how Rithmic delivers position updates
As the Rithmic disclaimer above states, the sequence of events is not guaranteed by the provider's API design. In practice, Rithmic's API does not guarantee that position updates arrive in step with fills. NinjaTrader's Rithmic connection takes the account position from the position and PnL updates Rithmic sends, not from the fills themselves, so when one of those updates is late, out of order or lost, NinjaTrader keeps the wrong position until the next update arrives. That is also why placing and cancelling a distant limit order used to fix the display: it makes Rithmic send a fresh update.
The cause is on Rithmic's side, not in Replikanto, and it does not appear on Tradovate connections. Starting with Replikanto 1.7.0.0, Replikanto works around it.
What Replikanto 1.7.0.0 does about it
Starting with Replikanto 1.7.0.0, Replikanto asks Rithmic for the account's real position and hands the answer to NinjaTrader. No order is sent. If NinjaTrader was wrong, its position is corrected first and the action then works on the real position, so a phantom position is no longer there to be flattened. Replikanto does this:
- Before it flattens a follower account: when you click Flatten All, when you click a follower's Flatten (×) button, when the leader closes its position and Replikanto copies that Close to the followers, and when Follower Guard flattens a follower.
- Before Follower Guard acts on an out-of-sync follower: when it checks a follower whose recent fill had no position update, and again before its out-of-sync timer flattens the follower. A stale position no longer triggers a false out-of-sync flatten.
- On its own, about one second after a fill on a Rithmic account that is not followed by a position update. This corrects the position in NinjaTrader itself, including the Positions tab, even when nothing is about to be flattened.
It covers every account on a Rithmic connection in NinjaTrader, leader or follower, enabled or Off, including prop-firm accounts such as Apex and Topstep. Tradovate, Sim and other connections are not affected.
The setting
Right-click the Replikanto window, choose Properties..., and in the General group find Refresh a Rithmic account's position before acting on it. It is on by default, applies to every Replikanto tab (not only the one you opened it from), and is saved with the NinjaTrader workspace. We recommend leaving it on. When it is off, Replikanto neither re-reads the position before acting nor corrects it after fills.
What you may notice
- A Flatten on a Rithmic account waits for Rithmic's answer, typically around 200 ms and never more than 750 ms. If Rithmic takes longer, the Flatten goes ahead with the position NinjaTrader shows, as in earlier versions (the Log tab shows
Warning [1100]). - When a missed fill is corrected, the position's average price can show 0 for a few seconds, until Rithmic's next update.
How to confirm it in the Log tab
-
Info [1097]: Replikanto is about to re-read an account's position.reason=says why, for exampleflatten-manual,guard-out-of-sync-timerorexecution-without-position-update. -
Info [1098]: the re-read finished.outcome=Confirmedmeans Rithmic agreed with NinjaTrader;outcome=Refreshedmeans NinjaTrader was wrong and has been corrected. -
Warning [1103]: a phantom position was caught and corrected.changes=shows the position before and after. -
Warning [1101]: the mechanism switched itself off for that Rithmic connection, for example because it cannot run on that NinjaTrader or Rithmic version. That connection then behaves as before 1.7.0.0. Please send us the line, including itsreason=.
Limits: when to still check RTrader Pro
- A Replikanto window must be open. The re-read runs only while at least one Replikanto window is open in NinjaTrader.
- The leader account when you click Flatten All. Flatten All re-reads each follower before flattening it. The leader account itself is flattened with the position NinjaTrader shows at that moment; for the leader, Replikanto relies on the automatic check about one second after each fill. If the leader's position looks wrong, check RTrader Pro before you click.
- NinjaTrader's own buttons. NinjaTrader's Flatten Everything (Positions tab) and the close buttons in Chart Trader and SuperDOM are not Replikanto actions, so they do not get the re-read before acting. Only the automatic check after fills applies to them.
- Followers on another computer (LAN or Internet copy) are re-read by the Replikanto running on that computer, which must also be on 1.7.0.0 or later.
-
Warning [1101]in the Log tab means that connection is back to the old behavior. - Versions before 1.7.0.0 do not re-read the position at all. Update Replikanto to get this protection.
Manual workarounds
In the cases above, or whenever NinjaTrader and RTrader Pro disagree, take what RTrader Pro shows as true. If NinjaTrader shows an outdated position, do not try to close it. Refresh it in one of these ways instead:
- Go to Connections > Disconnect, and then Connections > Connect.
- Or place a limit order far from the price, and then cancel it.
In short:
- Treat RTrader Pro as the source of truth for your real position.
- Do not repeatedly click Flatten All on a position RTrader Pro shows as closed; it can open an inverted trade.
- Reconnect (or place and cancel a distant limit order) to refresh the position.
Follower Guard on Rithmic accounts
Before 1.7.0.0, Follower Guard acted on whatever position NinjaTrader reported, so on a Rithmic account a phantom position could trigger a false out-of-sync alarm and an unnecessary flatten; that is why we used to advise against relying on Follower Guard on Rithmic accounts. Starting with Replikanto 1.7.0.0, Follower Guard gets the real position from Rithmic before it acts, as described above, so you can use it on Rithmic accounts, including Apex, Topstep and similar prop firms. If you are still on an older version, the old advice applies: update first.
Does "Copy Market Orders (Executions only)" fix this? No.
The copy mode only controls how the leader's orders are copied to the followers. The phantom position lives in NinjaTrader's own record of the account's position, so changing the copy mode neither causes nor prevents it. What protects you is the position re-read described above.
More information
NinjaTrader's forum thread about Rithmic positions not updating in NinjaTrader: https://forum.ninjatrader.com/forum/ninjatrader-8/platform-technical-support-aa/1309410-ninjatrader-rithmic-not-updating-positions
Comments
0 comments
Article is closed for comments.