When running a rotational system on the Nasdaq 100, I often get a disproportionate number of symbols starting with A.
Viewing the detail mode report, the symbols show they are the “Entry rank 1.” But over a 10-year look back, more than 90% of my “entry rank 1” symbols begin with A. It seems improbable (if my code is working as expected). Even when I change the PositionScore criteria from mean revision based systems to more breakout/trending systems.
Is there a secondary alphabetical sort after PositionScore? Are there effective ways bring in other symbols into the mix (those that don’t begin with A)?
@mradtke well here's a poor performing example, that demonstrates the point well enough:
#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"
SetOption("PortfolioReportMode", 0); // 0 = trade list; 1 = detailed; 2 = summary
SetBacktestMode( backtestRotational );
PositionScore = Close > MA(Close, 20)
AND NorgateIndexConstituentTimeSeries("Nasdaq 100");
Run against NASDAQ100 symbols from 2000 through 2017, 505 of the 670 trades taken are symbols beginning with letter A.
And I get similar results if my ranking method is more mean reversion based. Even when I add MaxOpenPositions and WorstRankHeld constraints it doesn't change much.
Put this code in the code editor and send it to the Analysis:
// Use in Analysis - Apply to 1 recent bar
PositionScore = Close > MA( Close, 20 );
Filter = 1;
// Use your condition to filter the stocks - NOT for the PositionScore
// Filter = Close > MA(Close, 20);
AddColumn( C, "Close" );
AddColumn( MA( Close, 20 ), "MA20" );
// all ones or zero....
AddColumn( PositionScore, "Score" );
// For position PostionScore use something that will give many distint values
AddColumn( ROC( C, 20 ), "ROC(20)", 3.5 );
AddColumn( RSI( 20 ), "RSI(21)", 3.5 );
All the "PositionScore" values using your code are "zero" or "one" so this explains why you'll get a lot of "A" stocks.
As @mradtke implicitly said, you need to change your logic to calculate the PositionScore using something that will result in a lot of distinct values.