I trade the ES Futures contract mechanically, and I want my to be able to backtest my system such that it has a maximum net position at any one time of abs(x) positions.
I can set the option to limit the number of Maximum Open Positions, but this doesn't help me when I am trading only 1 instrument. For example (Note I am using the backtest mode "backtestRegularRawMulti", so I take every raw signal my equity allows me.), the system can issue a buy, which will make me long. If the system issues a short, while I'm long, it will send a short order, which will make me effectively flat. This will count as 2 open orders in the backtester, but in reality, I have no positions open, and could take another abs(x) in either direction before I hit my maximum limit of open positions (x). So if I had 2 longs open, I could accept up to 5 shorts, if my maximum open position(x) was abs(3). This is different from exiting a position when a signal in the opposing direction is triggerred, as in "ReverseSignalForcesExit", since that option cancels the existing order. I need both to remain open, remembered, and exited at my sell/cover trigger, not the opposing short/buy signal. What I need is for Amibroker to tabulate both long and short positions distinctly, to count longs as positive, shorts as negatively, and to be able to set a maximum net position. I can do this in reality with no problems - send orders to IB based on a maximum net position, but I'd like to be able to do it in backtester, so I can validate the system. Any Ideas?
