Category
Strategy Elements
Description
Determines whether strategy uses a special variant of top-down setup selection
Choices
True - use greedy scoring mode
False - don't use greedy scoring mode (default)
Notes
GreedyScoring mode provides a way to employ a greedy algorithm within the top-down setup selection process.
When enabled, this mode causes SetupScore to be re-evaluated for each setup at each step of the selection loop.
This allows a kind of dynamic scoring process that includes each already-selected setup in the score for the next one.
The main use case for this mode is to produce an optimally uncorrelated portfolio.
The algorithm to do so works like this:
while setup slots remain, select the available setup with the lowest average correlation to open positions and other setups selected so far
Specifically in a RealTest script (from the optimal_diversity.rts example):
SetupScore: Select(OrderSum(1) = 0 and PositionSum(1) = 0, score1, -CorrelAvg(IsOrder or Shares > 0, roc1, bars))
In this example "score1" is calculated in Data and is only used when there are no open positions and no other setups selected yet, so nothing to correlate the new setup with:
score1: if(setup, -CorrelAvg(setup, roc1, bars), nan)
As can easily be imagined, re-evaluating CorrelAvg for a large number of symbols at each step of each period's setup selection loop can become VERY time consuming.
This example restricts its universe to the S&P 100 (OEX) and operates on a weekly timeframe. Those constraints make backtest performance tolerably fast.
There may be other use cases for GreedyScoring mode that do not involve correlation calculations.
|