I have many RS strategies that I have developed in other tools.
Below is simple AB test strategy. When number of positions (PosQty) is 1, the results are close to other tools.
However, when PosQty is 2 or more, and one (or more) symbols are sold, the SetPositionSize often prevents purchase of all replacements symbols on a date due to insufficient funds.
A local AB expert tells me that this can only be addressed with custom backtester. Or as below with margin, or more funds, which I don’t want.
Is there a simple efficient method to accomplish this relatively simple popular strategy? if necessary, simple custom backtest reference or code will be appreciated?
// Relative Strength Rotational Strategy based on max ROC // 1st Test 9 SP500 Sector ETF’s (e.g. XL?) and SPY EnableRotationalTrading(); // SetBacktestMode(backtestRotational) //SetTradeDelays(0,0,0,0); SetTradeDelays(1,1,1,1); BuyPrice = Close; SellPrice = Close; // BuyPrice = Open; SellPrice = Open; PosQty = Param("Max Number of Positions", 1, 1, 5, 1); SetOption( "MaxOpenPositions", PosQty ); SetOption("WorstRankHeld", PosQty); SetPositionSize(100/PosQty,spsPercentOfEquity); // invest 100% of equity in single security RoundLotSize = 0; SetOption("AccountMargin",50);