PROTECTED SOURCE SCRIPT
Composite Index Divergences

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:
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.
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.
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。