This is how the signal is built:
1. First it takes the SMA of the closing price.
2. It then takes the ROC of that SMA using a length of 1.
3. It takes an 8-period SMA and also a 64-period SMA of that ROC.
4. These are plotted as follows:
- the ROC is plotted in green when above 0 (trending up) and red when below 0 (trending down).
- the 8-period SMA is plotted as a thin white line within the ROC signal
- the 64-period SMA is plotted as a thick white line within the ROC signal
When the trendline is green, this is a bullish zone. When the trendline is red, this is a bearish zone.
Moving averages (all types of moving averages) are inherently lagging signals. To compensate for that, I am offsetting each SMA series by half of its period. This may be confusing to some, but the end result is a mathematically accurate SMA signal, centered on the signal that it is providing the moving average of. It doesn't stop the lag, but it directly and obviously shows how lagged each signal is, which I personally find better to trade against.
Symbols on the top and bottom of indicator:
- Yellow triangle at bottom of indicator shows where a downward trend is starting to bottom out and a buy/long opening may be available soon.
- Green triangle at bottom of indicator shows that a downward trend has switched to an upward trend. This indicates a good time to buy.
- Yellow triangle at top of indicator shows where an upward trend is starting to plateau and a sell/short opening may be available soon.
- Red triangle at top of indicator shows that an upward trend has switched to a downward trend. This indicates a good time to sell.
Note: You may see multiple yellow triangles before seeing a green or red triangle. This can happen when multiple trend accelerations or decelerations occur within an overall green or red zone.
In addition there is a dotted line connecting the end of the 64-period SMA to the end of the 8-period SMA. This indicates the direction the trend is moving towards. When the dotted line crosses the zero line, this portrays a rough estimate of where the trend may switch from a downtrend to an uptrend or vice versa. This is the "best" time to buy or sell, depending on your strategy.
I recommend placing a SMA on your candles set to the same window size as this indicator, and also to offset that SMA to the left by half its window size. For example, a 90-period SMA should be offset by -45 periods. That will cause it to be correctly aligned with this trend signal.
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.