- Min: Minimum period of the moving average
- Max: Maximum period of the moving average
- Src: Source input of the moving averages
- Number Of Columns: Number of columns to be displayed in the panel, handy when using a large range of periods.
Looking at the direction of moving averages with different periods is extremely useful when it comes to having information about the short/mid/long term overall market sentiment, and can also tell us if the market is trending or ranging.
Here we use periods ranging from 25 to 50, we can see that shorter moving averages react to the recent upward price variation, longer-term moving averages however are still affected by the overall downward variation you can see on the image. We can as such get information about the presence of potentials divergences, with shorter-term moving averages reacting to the divergence while the longer-term moving averages will still display the direction of the main trend.
As such the indicator can give information about how clean a trend is, with a clean trend being defined as a variation containing no retracements. When our trend contains no retracement, the mid/long term moving averages will all have the same direction, however, when a retracement is present, the midterm moving averages might be affected by it, thus displaying a direction contrary to the main trend.
When the market is ranging we can expect the panel to display an equal number of decreasing/increasing moving averages.
When using a large range of periods, you might have an error message showing: "String is too long", try lowering the range of periods by increasing Min or decreasing Max.
If the script displays the error message "Loop is too long to execute", try resetting the settings and change them back to the one you wanted to use.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.