OPEN-SOURCE SCRIPT

MA Orderliness

278
MA Orderliness measures how well a series of simple moving averages (SMAs) are stacked in the expected order for a trending market and turns that measurement into a normalized oscillator. You choose how many MAs to include and the shortest and longest lengths. The script generates a family of evenly spaced SMAs between those lengths, then compares each pair: shorter MAs should lie above longer ones in an uptrend and below in a downtrend. When any pair is out of order, a “violation” score is accumulated, but violations between nearby MAs count more heavily than those between MAs that are far apart. All weights are summed, and the total weighted violations are converted into a score from –1 (completely reversed) to +1 (perfectly ordered).

This orderliness score is plotted as a line oscillator. A fixed horizontal line at +1 marks perfect order, and another at –1 marks perfect reversal. To smooth the raw oscillator and generate trading signals, the script also plots a simple moving average of the orderliness score over a user-defined period. When the unsmoothed score crosses above its moving average, a bullish crossover alert fires. When it crosses below, a bearish crossover alert fires.

Everything is calculated on each bar so you can see the oscillator evolve in real time. You can customize the number of MAs, their minimum and maximum lengths, and the length of the signal-line SMA to suit different timeframes or markets.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.