This article explains what the Replikanto Flatten All button closes, how to get its confirmation question back when it flattens without asking, 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.
Exception: tabs that use the Pct Change method. When the tab's Method is Pct Change and the leader has an open position, Flatten All closes the leader but normally leaves that tab's followers in their positions: with Pct Change, closing the leader's position does not close the followers' positions. Followers with Market Only are the exception and are closed together with the leader. If the leader is already flat when you click Flatten All, the followers on this computer are closed as described above. To close Pct Change followers while the leader is in a position, use each row's Flatten (X) button, the group's Flatten (1.7.1.0 or later) or NinjaTrader's Flatten Everything (see below). A Disarmed follower that keeps its position is not re-armed (see below). Followers on another computer are covered in the next section.
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).
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.
If the Replikanto tab on the follower's computer uses Pct Change, Flatten All on the leader's computer does not close those followers, even when the leader is already flat. The only exception are followers that are On with Market Only, which are closed when the leader's position is closed. To close the others, click Flatten All on the follower's computer as well: there it closes every follower that is not Off, Pct Change included.
The confirmation question
Flatten All asks for confirmation first: 1 = Yes sends the close orders; 2 = No cancels and nothing is closed.
Starting with Replikanto 1.7.1.0, closing this window with its X also cancels (on earlier versions it flattened). If you tick NinjaTrader's Don't show this message again in the window and click Yes, later clicks of Flatten All flatten straight away, without asking.
Starting with Replikanto 1.7.2.0, ticking that box and clicking Yes turns off the option Ask before Flatten All in Replikanto's Properties, and the Log tab shows:
Replikanto: [UI] Flatten All's confirmation was turned off from its box ("Don't show this message again"). Turn it back on in Properties > Ask before Flatten All.
Only Yes with the box ticked turns the option off. Ticking the box and clicking No, closing the window with its X, or ticking and then unticking the box before clicking Yes change nothing. While the option is off, each click of Flatten All flattens straight away and the Log tab shows this line instead of a question:
Replikanto: [Copier] Flatten All's confirmation is turned off (Properties > Ask before Flatten All). Going ahead.
Starting with Replikanto 1.7.2.0, if NinjaTrader's confirmation window cannot be opened (this has happened while NinjaTrader was half closed), Replikanto asks the same question in a plain Windows Yes/No box instead of silently dropping the click. That box appears only while Ask before Flatten All is on: with the option off, Flatten All opens no window of any kind. Its buttons are in your Windows language, and it has no Don't show this message again box. The Log tab then shows Warning [1132]. If no box can be opened at all, the Flatten goes ahead, because you clicked it, and the Log shows Warning [1133]: check that the accounts really are flat. On earlier versions the click did nothing in this situation.
Flatten All flattens without asking (for example right after updating)
When Flatten All flattens with no question, the option Ask before Flatten All is off. Either the box Don't show this message again was ticked with a Yes, as described above, or the choice was carried over from NinjaTrader: if you had hidden the question in NinjaTrader on Replikanto 1.7.1.0 or earlier, Replikanto 1.7.2.0 reads that once, the first time it runs on the computer, and keeps the question hidden. The Log tab then shows, once:
Replikanto: [UI] Info [1141] The Flatten confirmations were carried over from NinjaTrader's "Don't show this message again", read once on this computer: a question hidden there stays hidden, and Properties > Ask before Flatten All / Ask before a group's Flatten turn it back on. flattenAll='off' groupFlatten='on'
flattenAll='off' means Flatten All's question came over hidden, and groupFlatten='off' means the same for a group's Flatten. In either case, turn the option back on in Properties, as described below.
Get the question back
Starting with Replikanto 1.7.2.0:
- Right-click anywhere in the Replikanto window and select Properties.
- In the General group, tick Ask before Flatten All.
- Click OK.
The option applies to every Replikanto tab and workspace on this computer and takes effect at once, with no restart. A group's Flatten has its own option, Ask before a group's Flatten, in the same group. On Replikanto 1.7.2.0, editing UI.xml changes nothing: Replikanto reads that file only once, the first time 1.7.2.0 runs on the computer.
Replikanto 1.7.1.0 or earlier: To get the question back, close NinjaTrader, keep a copy of Documents\NinjaTrader 8\UI.xml, open that file in a text editor such as Notepad, delete the line <ReplikantoFlatAll /> inside <DoNotShowMessages>, save it and start NinjaTrader again. NinjaTrader has no option in its own windows to show the question again, and it must stay closed while you edit the file, or the change can be lost. A group's Flatten has its own line, <ReplikantoGroupFlatten />.
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 Disarmed followers that show flat; a follower that still shows an open position stays Disarmed.
Starting with Replikanto 1.7.2.0, Flatten All waits for that follower's close: a Disarmed follower that already shows flat is re-armed right away, as before, and one that still shows a position is checked again after its close has been sent and finished, then once a second for 15 seconds, and re-armed as soon as it shows flat while the leader is flat too. Only if it still shows a position at the end does it stay 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.
On Replikanto 1.7.1.0 and earlier, Flatten All checked each follower only once, about a second after the click, so a close still being filled (common on Tradovate, on Rithmic and, on NinjaTrader 8.1.7 and 8.1.8, on Sim accounts with Enforce partial fills enabled) left the follower Disarmed almost every time. Starting with 1.7.2.0, Warning [1073] means the follower still showed a position 15 seconds after its close finished: the close did not fill, or NinjaTrader's position update took longer than that.
A follower that went flat while the leader already holds a new position is not re-armed either, because it would be out of sync with that trade. The Log tab then shows Info [1135] ("Flatten All did not re-arm this follower: it went flat, but only while the leader already held a position again"); re-arm it from its row or the Rearm button once the leader is flat.
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). Starting with Replikanto 1.7.2.0, the row's X re-arms a Disarmed follower only once it reads flat; if it still shows a position about 15 seconds later, it stays Disarmed and the Log tab shows
Warning [1140]. - 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. Starting with 1.7.2.0, a hidden follower account is never re-armed by Flatten All.
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 the accounts of that group, on the leader's instrument, and nothing outside the group. Flatten All closes every follower that is not Off (with the Pct Change exception above).
- Starting with Replikanto 1.7.2.0, it leaves followers that are Off alone, like Flatten All. Disarmed and Market Only accounts are closed. On Replikanto 1.7.1.0 or earlier it also closed followers that are Off.
- It never closes the leader account, even if the leader is listed in the group. Flatten All closes the leader.
- It asks first (a Yes/No window titled "Follower group" with the group name), unless its own option, Ask before a group's Flatten (Properties > General, starting with Replikanto 1.7.2.0), is off: ticking Don't show this message again in that window and clicking Yes turns it off, and ticking that option again brings the question back. It is separate from Ask before Flatten All. It asks even when every account of the group is already flat; the question says how many of them hold a position or orders. If the leader has no instrument selected, or the group has no follower account available in NinjaTrader, 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 (here Sim102 and Sim103; starting with Replikanto 1.7.2.0 it leaves Sim104 alone, because 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 on NinjaTrader 8.1.8 or earlier, starting with Replikanto 1.7.0.0, Replikanto re-reads each follower's real position from Rithmic before flattening it (NinjaTrader 8.1.9 fixed these missed Rithmic position updates itself, so Replikanto 1.7.2.0 does not do this re-read there), 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. Starting with Replikanto 1.7.2.0, a Tradovate follower closed by Flatten All or by a replicated leader Close waits up to 15 seconds for a fill that has not reached its position yet, so the close is sized on the position it really holds. 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]. Starting with Replikanto 1.7.2.0, Replikanto checks again 20 seconds after the Flatten and writesWarning [1121]only if the position is still open then ("NinjaTrader's Flatten was called for this account, no close order appeared within 8 s, and the position was still open 20 s after the call"); a flatten that closed late writesInfo [1136]instead. 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". - The tab uses the Pct Change method. With the leader in a position, Flatten All closes the leader but not that tab's followers (except Market Only ones). See What Flatten All closes above.
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.