OPEN-SOURCE SCRIPT

Moving Average Crossover Signal

204
ekran görüntüsü
Moving Average Crossover Signal

This is a customizable multi-symbol, multi-timeframe indicator that provides a compact visual signal based on the relationship between two user-defined moving averages. It is designed to function as a simple “red light” or “green light” for the current trend, allowing moving average conditions to be monitored without displaying the moving averages themselves. The signal can also track a ticker different from the active chart symbol, making it possible to monitor another market without keeping that ticker’s chart open.

The indicator calculates two independently configurable moving averages on a selected ticker and timeframe, then displays a persistent signal icon in a user-selected area of the chart. Instead of plotting historical crossover markers or moving average lines, it provides a clean at-a-glance indication of whether the configured MA condition is currently active.

Signal Logic

Two signal modes are available:
  • Crossover Only — the signal is active while Moving Average 1 is above Moving Average 2.
  • Crossover + Both MAs Sloping Up — the signal is active only while Moving Average 1 is above Moving Average 2 and both moving averages are rising over the selected slope lookback period.

The signal icon uses independently configurable colors for active, inactive, and unavailable-data conditions.

Ticker and Timeframe Selection

The signal can be calculated from a ticker that is different from the symbol currently displayed on the chart. Leaving the ticker input blank uses the active chart symbol.

A separate Signal Timeframe input allows the moving averages and signal logic to be calculated using a timeframe independent of the chart timeframe. Leaving the timeframe set to the chart interval uses the current chart timeframe.

This makes it possible, for example, to monitor a daily moving average condition while viewing an intraday chart, or to monitor one symbol's higher timeframe trend while analyzing another symbol.

Moving Average Configuration

Both moving averages can be configured independently with:
  • SMA
  • EMA
  • WMA
  • RMA
  • HMA

The slope-filtered mode also includes a configurable lookback period that determines whether each moving average is considered to be rising.

Signal Display

The on-chart signal is designed to remain compact and unobtrusive. Display options include:
  • Multiple signal icon styles
  • Active, inactive, and no-data colors
  • Automatic display of the selected ticker
  • Custom text that can override the ticker label
  • Signal icon before or after the display text
  • Independent icon and text sizes
  • Nine standard chart locations
  • Additional spacer rows above or below the signal for finer vertical positioning
  • Customizable panel background, including full transparency

The indicator does not plot the moving averages themselves, keeping the chart free of additional lines.

Alerts

A TradingView alert condition is included for the actual bullish moving average crossover event.

When Crossover + Both MAs Sloping Up is selected, the crossover must also occur while both moving averages satisfy the selected upward-slope condition.

This keeps the persistent visual signal separate from the crossover event: the icon shows the current state of the configured condition, while the alert identifies the point at which a qualifying crossover occurs.

Usage and Limitations

For the most reliable results, use a Signal Timeframe that is the same as or higher than the chart timeframe.

Lower timeframe selections may not capture every crossover that occurs between chart bars, so signals can be missed.

Higher timeframe signals may also change while that candle is still forming, so they should be considered provisional until the selected timeframe closes.

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.