Hello,
I've created a formula that uses the backtestmode(backtestRotational), with the purpose of being long the S&P 500 select SPDR sector ETF (there are 11 total sector etfs - xlb, xlc, etc.) with the highest Linear Regression Slope ( a simple relative strength model). As a result, over the time horizon selected, the portfolio is long only one etf with the highest rank. I've done so with the following two methods:
Method 1
SetBacktestMode( backtestRotational);
SetOption("InitialEquity", 100000);
SetOption("MinShares", 1);
SetOption("AllowPositionShrinking", True);
SetOption("MaxOpenPositions", 1);
SetOption("WorstRankHeld",1);
SetPositionSize(100, spsPercentOfEquity);
A = Optimize("LRS Length", 110, 10, 300, 10);
PositionScore = 100000 + LinRegSlope( C, A );
Method 2
SetBacktestMode( backtestRotational);
SetOption("InitialEquity", 100000);
SetOption("MinShares", 1);
SetOption("AllowPositionShrinking", True);
SetOption("MaxOpenPositions", 1);
SetPositionSize(100, spsPercentOfEquity);
A = Optimize("LRS Length", 110, 10, 300, 10);
PositionScore = 100000 + LinRegSlope( C, A );
The only difference between these two methods is that Method 1 has the additional line:
SetOption("WorstRankHeld",1);
My thoughts are that this line is actually not needed since SetOption("MaxOpenPositions", 1) is present in each methodology. I also thought that results for these two methods would therefore be identical. When tested, both methods are long only one ETF at a time.
Interestingly, I get meaningfully different results between the two methods. When I include the line SetOption("WorstRankHeld, 1), the number of trades went up quite a lot and obviously the results are different.
Why is that?
In the method without the line SetOption("WorstRankHeld", 1), how does the system decide when to exit the existing long position and enter a new long position in a different etf?
Thanks