OPEN-SOURCE SCRIPT
Pullback Pro Dow Strategy v7 (ADX Filter)

### **Strategy Description (For TradingView)**
#### **Title:** Pullback Pro: Dow Theory & ADX Strategy
---
#### **1. Summary**
This strategy is designed to identify and trade pullbacks within an established trend, based on the core principles of Dow Theory. It uses market structure (pivot highs and lows) to determine the trend direction and an Exponential Moving Average (EMA) to pinpoint pullback entry opportunities.
To enhance trade quality and avoid ranging markets, an ADX (Average Directional Index) filter is integrated to ensure that entries are only taken when the trend has sufficient momentum.
---
#### **2. Core Logic: How It Works**
The strategy's logic is broken down into three main steps:
**Step 1: Trend Determination (Dow Theory)**
* The primary trend is identified by analyzing recent pivot points.
* An **Uptrend** is confirmed when the script detects a pattern of higher highs and higher lows (HH/HL).
* A **Downtrend** is confirmed by a pattern of lower highs and lower lows (LH/LL).
* If neither pattern is present, the strategy considers the market to be in a range and will not seek trades.
**Step 2: Entry Signal (Pullback to EMA)**
* Once a clear trend is established, the strategy waits for a price correction.
* **Long Entry:** In a confirmed uptrend, a long position is initiated when the price pulls back and crosses *under* the specified EMA.
* **Short Entry:** In a confirmed downtrend, a short position is initiated when the price rallies and crosses *over* the EMA.
**Step 3: Confirmation & Risk Management**
* **ADX Filter:** To ensure the trend is strong enough to trade, an entry signal is only validated if the ADX value is above a user-defined threshold (e.g., 25). This helps filter out weak signals during choppy or consolidating markets.
* **Stop Loss:** The initial Stop Loss is automatically and logically placed at the last market structure point:
* For long trades, it's placed at the `lastPivotLow`.
* For short trades, it's placed at the `lastPivotHigh`.
* **Take Profit:** Two Take Profit levels are calculated based on user-defined Risk-to-Reward (R:R) ratios. The strategy allows for partial profit-taking at the first target (TP1), moving the remainder of the position to the second target (TP2).
---
#### **3. Input Settings Explained**
**① Dow Theory Settings**
* **Pivot Lookback Period:** Determines the sensitivity for detecting pivot highs and lows. A smaller number makes it more sensitive to recent price swings; a larger number focuses on more significant, longer-term pivots.
**② Entry Logic (Pullback)**
* **Pullback EMA Length:** Sets the period for the Exponential Moving Average used to identify pullback entries.
**③ Risk & Exit Management**
* **Take Profit 1 R:R:** Sets the Risk-to-Reward ratio for the first take-profit target.
* **Take Profit 1 (%):** The percentage of the position to be closed when TP1 is hit.
* **Take Profit 2 R:R:** Sets the Risk-to-Reward ratio for the final take-profit target.
**④ Filters**
* **Use ADX Trend Filter:** A master switch to enable or disable the ADX filter.
* **ADX Length:** The lookback period for the ADX calculation.
* **ADX Threshold:** The minimum ADX value required to confirm a trade signal. Trades will only be placed if the ADX is above this level.
---
#### **4. Best Practices & Recommendations**
* This is a trend-following system. It is designed to perform best in markets that exhibit clear, sustained trending behavior.
* It may underperform in choppy, sideways, or strongly ranging markets. The ADX filter is designed to help mitigate this, but no filter is perfect.
* **Crucially, you must backtest this strategy thoroughly** on your preferred financial instrument and timeframe before considering any live application.
* Experiment with the `Pivot Lookback Period`, `Pullback EMA Length`, and `ADX Threshold` to optimize performance for a specific market's characteristics.
---
#### **DISCLAIMER**
This script is provided for educational and informational purposes only. It does not constitute financial advice. All trading involves a high level of risk, and past performance is not indicative of future results. You are solely responsible for your own trading decisions. The author assumes no liability for any financial losses you may incur from using this strategy. Always conduct your own research and due diligence.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.