OPEN-SOURCE SCRIPT

Momentum Divergence Tracker

This Pine Script v6 component is designed to identify momentum divergences across multiple timeframes, allowing traders to spot potential trend reversals.

How it works:
  • Divergence Detection: The script identifies bullish and bearish divergences between price movements and momentum indicators (Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD), Stochastic Oscillator). A divergence occurs when the price makes a lower low, but the indicator makes a higher low (Bullish Divergence) or makes a higher high, but the indicator makes a lower high (Bearish Divergence).
  • Multi-Timeframe Analysis: The script evaluates divergences across user-specified timeframes (e.g., 15m, 1h, 4h). The function uses request.security to access higher timeframes, ensuring alignment with the trader’s analysis preferences.
  • Volume-Based Filtering: Signals are validated using a high-volume filter, where current volume must exceed a multiplier of the 20-period moving average of volume.
  • Signal Aggregation: The results from multiple timeframes are combined into a single output - a bullish signal is triggered when any timeframe shows bullish divergence under high volume, and a bearish signal is triggered when any timeframe shows bearish divergence under high volume.
  • Visualization: Bullish divergences are plotted as green upward triangles below price bars and Bearish divergences are plotted as red downward triangles above price bars.


Inputs:
  • RSI Settings: RSI Length.
  • MACD Settings: MACD Fast Length, MACD Slow Length, MACD Signal Length.
  • Stochastic Settings: Stochastic Length, %K, %D.
  • Volume Multiplier: A filter that multiplies the average volume threshold.
  • Timeframes: Comma-separated list of timeframes for analysis (e.g., 15m, 1h, 4h).


Alerts:
  • Alerts can be triggered when Bullish Divergence or Bearish Divergence is detected.


Use Case:
  • Identify Reversals: Spot potential trend changes driven by momentum divergence.
  • Multi-Timeframe Analysis: Analyze divergences across various timeframes in one script.
  • Volume Confirmation: Ensure signals align with significant volume activity to increase reliability.


To use this component, add it to your TradingView chart. Customize the input parameters to fit your strategy and monitor the visualized divergences for potential trading opportunities.

Pernyataan Penyangkalan