Güncellendi

Best of N: Selection Premium on One Rule

187
One rule, twenty lengths, nothing else changed.

The rule is deliberately dull: long while price is above a simple moving average, flat otherwise. The script runs it at twenty different lengths at once and keeps a separate equity curve for each - the running sum of simple bar returns, with no commissions or slippage modelled.

Blue is the best of the twenty. Grey is the median of the twenty. Red is the gap between them.

That gap is the selection premium. The best of a set always sits at or above its median, so the gap appears on almost any symbol and timeframe. If the twenty lengths had no real difference between them, all of it would be the reward for having looked at twenty, not for having an edge.

Two things worth watching. The gap rarely closes. And the length that is winning moves around: it is plotted in the status line, and it is a property of the sample rather than of the market.

So when a backtest is presented to you, the number that is almost never on the page is how many variants were tried before that one. This script is a way to see what that number is worth.

Open source so you can change the rule, the step and N and watch the gap behave the same way. Platform mechanics and arithmetic, not a result of mine. Nothing here is investment advice.
Sürüm Notları
Chart refresh: the first preview also showed another indicator's table on the price pane; this snapshot shows the script on its own. Code: one comment added explaining the median index; nothing the script computes has changed.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.