I was attempting to code a strategy that uses multiple exit conditions, and came across what appears to be a bug.
The Strategy is to allow entry and exit on the same bar, but to only ever allow 1 open postion in the same symbol at any time. Here is working code WITHOUT an OR in the sell condition:
SetOption("AllowSameBarExit", True );
SetOption("SettlementDelay", 1 );
Buy = C > MA(C,10);
Sell = C > O;
// trade on todays open
SetTradeDelays( 0, 0, 0, 0 );
BuyPrice = Open;
SellPrice = Close;
SetPositionSize( 20, spsPercentOfEquity );
This works exactly as it should - it allows entering and exiting on the same day, but only allows 1 open symbol at any time. However as soon as we add an OR into the sell condition like:
Sell = C > O OR C < MA(C,10);
the Backtester allows the same symbol to be entered on the same day of the exit:
(Which when buying at the open and selling on close would allow more than 1 open position on a symbol)
Is there any workaround when using multiple sell conditions and same bar entry exit, while still only ever allowing 1 open trade per symbol per day?