About Granville's 8 Rules Moving Average Signals
Unlike Granville tools that mark a condition on almost every bar, or only the pullback rules 2 and 3, Granville's 8 Rules Moving Average Signals marks all eight rules as one-time events and shows where price is too far from the MA.
How it works
- Moving average: EMA 200 by default. SMA, EMA, SMMA (RMA), WMA and VWMA are available. Distances are measured in ATR (the 14-bar average true range).
- MA direction: rising when the average distance between the close and the MA over the last 30 bars is at least 0.5 ATR above the MA, falling when it is that far below, flat otherwise. A direction holds until the distance falls below half of that, so it does not flip each time price crosses the MA.
- 1 Breakout above the MA: after the MA stops falling, the first close above the MA. 5 Breakdown below the MA is the mirror.
- 2 Back above the rising MA: while the MA is rising, price touches the MA and closes below it, then closes back above it within 30 bars of the touch. 6 Back below the falling MA is the mirror.
- 3 Bounce off the rising MA: while the MA is rising, the low comes within 0.15 ATR of the MA without a close below it, then a close above the high of the touching bar within 30 bars. 7 Bounce off the falling MA is the mirror.
- 4 Rebound from far below: while the MA is falling, a close 4 ATR or more below the MA, then a close above the high of the lowest bar. 8 Drop from far above is the mirror.
- One signal per move: after the direction changes or 2, 3, 6 or 7 appears, the close must move 1 ATR away from the MA before the next touch counts, and 2, 3, 6 and 7 are at least 5 bars apart. 4 and 8 come once per run and are cancelled if the close comes back within 1 ATR of the MA.
- Timeframe: the MA and the rules can run on a higher timeframe. Its bars are built from completed bars and the current price, so past numbers show what was known at the time.
On the chart
- The MA is green while rising, red while falling and gray while flat.
- Numbers: green below the bar for buy rules 1–4, red above the bar for sell rules 5–8. Numbers from a higher timeframe carry its name, for example "4h 3".
- Far lines: dotted lines 4 ATR from the MA, above it while the MA is rising and below it while the MA is falling.
- Far zones: a box from the close beyond the far line until rule 8 or 4 appears, or price comes back near the MA. Red above the MA, green below.
- Summary at top right: the MA direction and what to wait for, the last rule, and the far line price. With Show higher timeframes on, it adds the direction of the same MA on two higher timeframes, for example "4h ▲ · D –".
- Each rule can be turned off in Buy rules and Sell rules, and every part of the display can be turned off.
Alerts
- One alert for everything: create it with "Any alert() function call". In the Alerts settings, choose the rules (All, Buy rules, Sell rules, With the trend, Breakouts, Back across the MA, Bounces, From far away, or Only 1 to Only 8) and the other events: Entered a far zone, MA direction changed, and Touched the MA (off by default, it comes before 2, 3, 6 and 7).
- One alert per event: pick the event in the alert's Condition list, for example "Buy 2 · Back above the rising MA". There are 17.
- Message format: Text, or JSON for webhooks (indicator, ticker, chart_tf, ma_tf, price, ma and the list of events).
- Alerts are sent once when a bar of the MA's timeframe closes, never on past bars, and do not depend on what is shown on the chart.
- Rules are judged on closed bars only, and a number never moves after it appears. The caution note TradingView shows when you create the alert appears for almost every custom script.
Notes
- The first numbers appear after the MA length plus 31 bars (231 bars with EMA 200) on the rules' timeframe.
- The summary follows the current price. Numbers appear only when the bar closes.
- Signals can differ between data feeds.
How to add it
- 1Open the script page on TradingView with the button above (or here).
- 2Click “Add to favorites” on that page.
- 3On any chart, open Indicators, go to Favorites and click Granville's 8 Rules Moving Average Signals [Saikix].
First steps on the chart
- Start with the top-right summary: the MA direction and what to wait for, for example "Rising MA · wait for a pullback (2 3)", then the last rule and the far line price.
- The moving average is EMA 200 by default; SMA, EMA, SMMA (RMA), WMA and VWMA are available, and the MA and the rules can run on a higher timeframe.
- For one alert covering everything, create it with "Any alert() function call" and choose the rules in the Alerts settings. For a single event, pick it in the alert's Condition list, for example "Buy 2 · Back above the rising MA".
- A far zone starts with a close beyond the dotted far line, 4 ATR from the MA, and lasts until rule 8 or 4 appears or price comes back near the MA.