Rotational backtest exits immediately

I am doing a rotational backtest to hold the 10 highest momentum stocks in the S&P 500 using Norgate's historical approach. It all appears to work well, but all trades are exited immediately. Here is a portion of the report:

And there is the script:

// Load the Norgate tools
#include_once "Formulas\Norgate Data\Norgate Data"
// invoke the rotational tester
// number of positions to hold
MaxPositions = 10;
SetOption("MaxOpenPositions", MaxPositions );
// cutoff rank
SetOption("WorstRankHeld", 10);
// set position size to leave approximately 5% cash
SetPositionSize( 100 / MaxPositions, spsPercentOfEquity);
SetOption("AllowPositionShrinking", True); 
// trade at the open
SetTradeDelays(1, 1, 1, 1);
BuyPrice = Open;
// one year using weekly data
LookBack = 52;
// add large integer to prevent short positions
PositionScore = IIf(NorgateIndexConstituentTimeSeries("$SPX"), 10000 + ROC( C, LookBack), 0);
// That's all folks!

Any Ideas?


Please add 2 lines

Filter = 1;
AddColumn( PositionScore, "PositionScore");

and run your code as exploration. You will see PositionScore values

PositionScore value of zero causes exit. See


Thanks for the reply! That was one of the first debugging steps I took. The components of the S&P 500 (current and lapsed) return non-zero position scores. However the equities not in the S&P returned zero scores. So I changed the PositionScore line to:
PositionScore = IIf(NorgateIndexConstituentTimeSeries("$SPX"), 10000 + ROC( C, LookBack), 900);
That eliminates the zeros, but I still get the early exits. (I have stops turned off.)




Solved: Using the Norgate dynamic watch list "S&P 5000 Current & Past" eliminates the problem.


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.