Skip to content
All library documents

Detecting Price–Indicator Divergence with Configurable Normalization and Exits

Article Strategy library · Author: Trading-IQ

Summary

This strategy script detects regular and hidden bullish and bearish divergence between price and a selected indicator. It offers pivot-based detection, which uses left and right lookback settings, and an immediate method. Users can choose whether divergence detection uses closing prices, select a normalization approach such as rolling min–max, rolling z-score or robust scaling, and control which divergence types are displayed or traded.

The strategy settings expose ATR-based or percentage-based stop and target exits, along with trade sizing and execution assumptions in the script configuration. The excerpt establishes a configurable framework for divergence signals, but it does not include the complete source or explanatory discussion of how signals translate into entries, how positions are managed, or what results were observed. It also supplies no market, timeframe or backtest period. Consequently, the available material supports describing the signal-design choices, but not judging profitability, robustness or the relative merits of the detection and normalization options.

Key ideas

  • The script supports pivot-based and immediate methods for detecting divergence.
  • Pivot detection uses configurable left lookback and right lookahead settings.
  • Regular and hidden bullish and bearish divergence types can be enabled for display and trading independently.
  • Indicator normalization can be disabled or set to rolling min–max, rolling z-score or robust scaling.
  • The excerpt offers ATR or percentage exit modes but does not provide enough context or results to assess strategy performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.