OPEN-SOURCE SCRIPT
Hidden Divergence PRO MAX v2 (Clean)

### **Hidden Divergence PRO MAX v2 (Clean)**
**Overview**
This is a high-performance, trend-following strategy designed specifically for the Crypto market (e.g., BTCUSDT.P). It utilizes **Hidden Divergence** between Price and RSI to identify trend continuation opportunities with institutional-grade risk management.
**Key Technical Features:**
* **Zero Repaint Logic:** Implements `lookahead=barmerge.lookahead_off` and HTF candle offsets to ensure backtesting results match real-time execution.
* **Multi-Layered Filtering:**
* **Trend Filter:** Uses a Higher Timeframe (HTF) EMA 200 to ensure trades are only taken in the direction of the macro trend.
* **Volume Exhaustion:** Compares current pivot volume against the previous pivot to confirm a lack of counter-trend pressure.
* **RSI Extremes:** Filters signals based on Overbought/Oversold thresholds to increase probability.
* **Candle Confirmation:** Includes toggleable modes for **Basic** (engulfing/color) or **Pinbar** (rejection) confirmation before entry.
* **Advanced Risk Management:**
* **Dynamic Position Sizing:** Automatically calculates quantity based on a fixed risk % of equity and ATR-based stop loss.
* **Position Capping:** Includes a safety "cap" to prevent over-leveraging when volatility is low.
* **Trailing Stop:** Optional ATR-based trailing exit to capture extended trend runs.
* **Cooldown System:** Prevents over-trading by locking execution for a set number of bars after a trade.
**Best Used On:**
* **Pairs:** BTCUSDT.P, ETHUSDT.P, and major Altcoins.
* **Timeframes:** 1H or 4H for optimal signal-to-noise ratio.
**Overview**
This is a high-performance, trend-following strategy designed specifically for the Crypto market (e.g., BTCUSDT.P). It utilizes **Hidden Divergence** between Price and RSI to identify trend continuation opportunities with institutional-grade risk management.
**Key Technical Features:**
* **Zero Repaint Logic:** Implements `lookahead=barmerge.lookahead_off` and HTF candle offsets to ensure backtesting results match real-time execution.
* **Multi-Layered Filtering:**
* **Trend Filter:** Uses a Higher Timeframe (HTF) EMA 200 to ensure trades are only taken in the direction of the macro trend.
* **Volume Exhaustion:** Compares current pivot volume against the previous pivot to confirm a lack of counter-trend pressure.
* **RSI Extremes:** Filters signals based on Overbought/Oversold thresholds to increase probability.
* **Candle Confirmation:** Includes toggleable modes for **Basic** (engulfing/color) or **Pinbar** (rejection) confirmation before entry.
* **Advanced Risk Management:**
* **Dynamic Position Sizing:** Automatically calculates quantity based on a fixed risk % of equity and ATR-based stop loss.
* **Position Capping:** Includes a safety "cap" to prevent over-leveraging when volatility is low.
* **Trailing Stop:** Optional ATR-based trailing exit to capture extended trend runs.
* **Cooldown System:** Prevents over-trading by locking execution for a set number of bars after a trade.
**Best Used On:**
* **Pairs:** BTCUSDT.P, ETHUSDT.P, and major Altcoins.
* **Timeframes:** 1H or 4H for optimal signal-to-noise ratio.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.