Flatten Positions
The FLATTEN
positions command is very powerful. It provides the option to flatten all positions across all accounts, a specific position for a particular instrument in a certain direction in one account, or anything in between.
The FLATTEN
command accepts several parameters:
account
instrument
market_position
(long, short)nothing
The parameters act as filters, searching for positions that match the criteria to be flattened.
Most importantly, if you execute command=FLATTEN;
without any other filters, it is similar to the FLATTENEVERYTHING
command. All positions will be closed. The only difference is FLATTENEVERYTHING
will close all positions and all orders across all accounts.
If FLATTEN
is executed with both an account
and an instrument
it will be equivalent to a generic CLOSEPOSITION
command.
Advanced Usage
If no account
is specified, but an instrument and/or market_position
is provided, FLATTEN
will exit all positions across all accounts that match that criteria.
Example Payloads
Flatten all MES 06-25 positions in Sim101 account (CLOSEPOSITION
equivalent):
Flatten all positions in the Sim101 account:
Flatten all short positions in Sim101:
Flatten all long positions across all NT8 accounts:
Flatten all MNQ 06-25 positions across all NT8 accounts:
Flatten all positions in all accounts:
Last updated