PROTECTED SOURCE SCRIPT

Composite Index Divergences

100
This is an automated trading strategy for TradingView designed to trade based on divergences between the price and a custom technical indicator called the "CMB Composite Index."
Main Functions:

"Composite Index Divergence" Calculation:
It generates a composite index by combining information from two RSIs (a long-period RSI and its rate of change, and a smoothed short-period RSI). This index is the primary tool for divergence detection.
Divergence Detection:
It identifies four types of divergences:
  • Regular Bullish: Lower lows in price but higher lows on the "CMB Composite Index."
  • Regular Bearish: Higher highs in price but lower highs on the "CMB Composite Index."
  • Hidden Bullish: Higher lows in price but lower lows on the "CMB Composite Index."
  • Hidden Bearish: Lower highs in price but higher highs on the "CMB Composite Index."

It uses pivot points (significant highs and lows) of both the price and the indicator to find these divergences within a user-defined range of bars.

Entry and Exit Logic:
It enters long (buy) or short (sell) positions when one of the user-selected divergences is confirmed and no position is currently open.

It manages trades with:
Stop Loss (SL): Based on a multiple of the ATR (Average True Range).
Take Profit (TP): Also based on a multiple of the ATR.
Close on Opposite Signal: Optionally, it can close a position if a divergence signal in the opposite direction appears.
Position size is calculated as a percentage of available equity.
Orders are processed at the close of the bar where the signal is confirmed.

Visualization (Optional):
It can draw lines on the chart to highlight the detected divergences.
It displays labels to identify the type of divergence.
It plots the Stop Loss and Take Profit levels for active trades.

In essence, the strategy looks for discrepancies between price action and momentum to generate trading signals, while managing risk with volatility-based Stop Loss and Take Profit levels.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.