This article explains what the Replikanto Flatten All button closes, why it may not close your positions, why a Disarmed follower can stay Disarmed after it, and how to close positions directly from NinjaTrader instead.
What Flatten All closes
The Flatten All button works only for the instrument selected in that Replikanto window or tab. It closes the leader account and every follower account that is not Off, including followers that are Disarmed (red). Followers that are switched off are not touched.
1 = the instrument of this tab: here Flatten All closes only ES 12-26; 2 = Flatten All; 3 = followers that are On (Sim102) or Disarmed (Sim103, red) are closed together with the leader; 4 = a follower that is Off (Sim104) is not touched.
Starting with Replikanto 1.7.0.0, this also covers a follower that is both Disarmed and set to Market Only. On earlier versions, when the leader had an open position, Flatten All could leave such a follower open and still re-arm it. If you are on an older version, update to 1.7.0.0 or later; until then, close that follower with its row's Flatten (X) button or with NinjaTrader's Flatten Everything (see below).
Flatten All asks for confirmation first: 1 = Yes sends the close orders; 2 = No cancels and nothing is closed.
Followers on another computer (local network or internet)
The Disarmed + Market Only fix applies to followers on the same computer as the leader. If a follower on another computer, copied over the local network or the internet, is both Disarmed and Market Only and stays open after Flatten All, click Flatten All in the Replikanto window on that follower's computer. There, Flatten All closes every follower that is not Off, Disarmed + Market Only ones included.
Why a follower stays Disarmed after Flatten All
After closing the positions, Flatten All re-arms the Disarmed followers of that tab (they turn back to On). Starting with Replikanto 1.7.0.0, it re-arms only the Disarmed followers that already show flat at that moment. A follower that still shows an open position stays Disarmed, and the Log tab shows:
Replikanto: [Copier] Warning [1073] Flatten All left this follower Disarmed because it still shows an open position; check it by hand, then re-arm it from this row or the Rearm button.
Right after Flatten All: 1 = the button shows Wait 2s and ignores clicks for two seconds; 2 = Sim103's close was still filling, so it still shows Long 1 and stays Disarmed (Warning [1073]); 3 = once Sim103 is flat, Rearm turns it back On.
This is normal and errs on the safe side. Flatten All checks each follower once, right after sending the close orders, and a close that is still being filled shows as an open position at that moment. It is common with Rithmic accounts and with Sim accounts when NinjaTrader's Enforce partial fills option is enabled. To resume copying:
- Check the follower's position in the NinjaTrader Control Center, Positions tab.
- If it still has a position, close it (row Flatten (X) button, or Flatten Everything below).
- Once it is flat, click Rearm. The Rearm button re-arms every Disarmed follower of the tab, so check them all first.
Before 1.7.0.0, Flatten All re-armed every Disarmed follower, even one still in a position.
Flatten only one group (1.7.1.0 or later)
Starting with Replikanto 1.7.1.0, when the Follower Accounts list is shown in groups, each group header has its own Flatten button (the × in the Flatten column of the header). It is not the same as Flatten All:
- It closes the position and cancels the working orders of every account of that group, on the leader's instrument, and nothing outside the group. Flatten All closes every follower that is not Off.
- It also closes followers that are Off, which Flatten All never touches. Disarmed and Market Only accounts are closed too.
- It never closes the leader account, even if the leader is listed in the group. Flatten All closes the leader.
- It always asks first when there is something to flatten (a Yes/No window titled "Follower group" with the group name, where No is the default). If the leader has no instrument selected, or the group has nothing to close, it does not ask.
- A Disarmed account is re-armed afterwards only if its position reads flat. Otherwise it stays Disarmed and the Log tab shows
Warning [1125]; check the account, then use the Rearm button that appears on the group header (it re-arms only the accounts that are flat) or the tab's Rearm button.
The full explanation is in the article Flatten or Rearm a whole follower group.
1 = Flatten All of the tab, 2 = the Flatten button of the Simulation group header: it closes only the accounts of that group (Sim102, Sim103 and Sim104, even though Sim104 is Off) and never the leader, 3 = the Rearm button next to the group name, shown because Sim103 is Disarmed.
When Flatten All won't work
- No open position is being reported by NinjaTrader. A position may be showing in Rithmic or Tradovate, but if it has not been updated in NinjaTrader, this button will not work. On Rithmic accounts, starting with Replikanto 1.7.0.0, Replikanto re-reads each follower's real position from Rithmic before flattening it, so a fill NinjaTrader missed is picked up and closed. The leader account itself is not re-read at the moment you click Flatten All (it relies on the automatic check about one second after each fill); if the leader still shows the wrong position, disconnect and reconnect the Rithmic connection. The re-read is controlled by the Refresh a Rithmic account's position before acting on it property, which is on by default. On other connections (Sim, Tradovate and others), Replikanto waits for NinjaTrader to apply a follower's latest fill to its position before flattening it, so a follower flatten right after a fill can take a moment longer, up to about 5 seconds. If a follower is left with a small opposite position, see Follower position inverted (opposite direction to the leader).
- The button was pressed in the wrong Replikanto window or tab. In the heat of the moment it is easy to hit Flatten All in a window or tab for a different instrument than the one you meant to close.
- There is a communication failure between NinjaTrader and the broker, so the close request is never sent. Disconnect and reconnect the broker connection in NinjaTrader, then try again.
-
An order was still in flight. NinjaTrader's Flatten can wait on a market order that the broker has not confirmed yet: it cancels that order first and closes the position only after the cancel is confirmed, and if the connection does not answer within a few seconds NinjaTrader gives up without closing (its own Log may then say "Close operation failed. Operation timed out"). Starting with Replikanto 1.7.1.0 the Log tab shows an Info line when Replikanto's Flatten finds such an order ("Flatten found ... market order(s) still in flight on this account and instrument") and, if no close order appeared after about 8 seconds and the position is still open,
Warning [1121]: "NinjaTrader's Flatten was called for this account, but no close order appeared within 8 s and the position is still open." Replikanto does not repeat the Flatten. Check the position at the broker before closing anything by hand, because the close may still be on its way. See Position Won't Close: "Close operation failed. Operation timed out".
Close positions from NinjaTrader instead
- Open the Positions tab in the NinjaTrader Control Center.
- Right-click within the positions grid section. This opens the following menu:
Select Flatten Everything — this flattens all open positions and cancels all working orders.
Live orders
CRITICAL — If your inquiry ever involves live orders, please always reach out to your broker's Orders Desk immediately to confirm and manage your live orders and positions.
Comments
0 comments
Article is closed for comments.