Divergence Backtester - V2
Nov 4, 2022

The Divergence Backtester - V2 indicator is a comprehensive tool designed to analyze and gather statistical data on the impact of price-oscillator divergences over short-term periods. By evaluating the relationship between the last two pivot states, it provides traders with a data-driven approach to estimating future pivot formations and trend exhaustion.
Usage
The script identifies pivots and compares price action with a selected oscillator to detect divergences. It utilizes a Zigzag-based structure to visualize market swings and project potential reversal points. Traders can use the statistical tables generated by the script to understand the historical probability of price movements following specific divergence patterns.
The tool provides insights into:
- Pivot Projections: Estimating the likely behavior of unconfirmed pivots based on historical data.
- Trend Sentiment: Identifying visual cues (symbols and labels) that categorize the current trend as continuing, exhausting, or diverging.
- Backtesting Stats: Analyzing "Pivot High" and "Pivot Low" projections to gauge the reliability of specific price/oscillator configurations.
Details
The script leverages a sophisticated multidimensional analysis of price and oscillator trends. It integrates various oscillators (RSI, CCI, CMO, COG, MFI, ROC) to identify discrepancies between price highs/lows and oscillator momentum. Unlike standard divergence tools, Version 2 focuses on the interaction between consecutive pivot states, allowing for a "bigger picture" estimation of market structure. It calculates sentiment based on the alignment (or lack thereof) between price direction, oscillator direction, and the overarching Zigzag trend.
Settings
- Zigzag Length: Determines the sensitivity of the pivot detection. A higher value identifies more significant swings, while a lower value captures minor price fluctuations.
- Oscillator Type: Allows selection from several oscillators (CCI, CMO, COG, MFI, ROC, RSI) to be used for divergence calculation.
- Oscillator Length: Sets the lookback period for the chosen oscillator.
- History (Supertrend Length): Controls the lookback period for calculating the internal trend status used in sentiment analysis.
- Draw Zigzag Supertrend: Toggles the visibility of the trend-based Zigzag lines on the chart.
- Text Size: Adjusts the size of the labels and symbols displayed on the chart.
FAQ
How do I interpret the symbols on the chart? The symbols represent trend sentiment: arrows indicate strong continuation or direction, while specific icons like "C" (Continuation) or "D" (Divergence) provide context on the current structural state.
Can I change the oscillator used for backtesting? Yes, you can switch between RSI, MFI, CCI, and other popular oscillators in the script settings to see which yields the most reliable results for your timeframe.
How do I access Divergence Backtester - V2? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

