
The Trend Pullback Professional Strategy is a trading system based on the core principles of Dow Theory, designed to identify and trade pullbacks within established trends. The strategy uses market structure (pivot highs and lows) to determine trend direction and leverages an Exponential Moving Average (EMA) to pinpoint pullback entry opportunities. To enhance trade quality and avoid ranging markets, an Average Directional Index (ADX) filter is integrated to ensure entries are only taken when the trend has sufficient momentum.
The strategy’s logic is divided into three key steps:
Step 1: Trend Determination (Dow Theory) * The primary trend is identified by analyzing recent pivot points * An Uptrend is confirmed when the strategy 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)
After thorough analysis of the code, the following significant advantages can be identified:
Market Structure-Based Trend Identification: The strategy uses Dow Theory’s core principles by utilizing pivot highs and lows to determine market trends, rather than relying solely on indicators, providing more reliable trend confirmation
Objective Entry Conditions: Entry points are determined through clearly defined price-to-EMA crossover relationships, reducing subjective judgment and making trading decisions more consistent and repeatable
Dynamic Risk Management: Stop loss positions are automatically set based on market structure rather than using fixed percentages or points, ensuring that stop points are relevant and reasonable to current market conditions
Flexible Profit Strategy: Dual take-profit targets allow traders to lock in partial profits when initial targets are reached while maintaining remaining positions to capture larger moves
Market Condition Filtering: The ADX filter helps avoid trading in non-trending or weak-trending markets, entering the market only when trend momentum is sufficiently strong
High Adaptability: Through adjustable parameters (such as pivot lookback period, EMA length, and ADX threshold), the strategy can adapt to the characteristics of different markets and timeframes
Complete Trading Cycle: The strategy handles the full trading cycle from trend identification, entry timing, risk management to exit strategy, providing a comprehensive trading system
Despite its sound design, the strategy has several potential risks and limitations:
Trend Change Delay: Pivot-based trend identification is inherently lagging and may lead to confirming trend changes only after the trend has already begun to reverse, especially in rapidly changing markets
False Pullbacks: In strong trends, price may not pull back deeply enough to reach the EMA level, resulting in missed trading opportunities; conversely, in choppy markets, multiple false pullback signals may occur
Over-Filtering: Too high an ADX threshold may cause missed favorable trading opportunities, while too low a threshold may fail to effectively filter weak trend conditions
Parameter Sensitivity: Strategy performance is highly sensitive to parameter settings, particularly the pivot lookback period and EMA length, and improper parameter selection may lead to poor strategy performance
Market Environment Dependency: The strategy is designed specifically for trending markets and may perform poorly in sideways, ranging, or highly volatile markets
Risk Mitigation Methods: * Conduct thorough historical backtesting to optimize parameters for specific markets and timeframes * Consider adding additional filters such as volatility indicators or trend strength confirmation * Implement adaptive parameters that adjust pivot lookback periods and EMA length based on current market conditions * Consider modifying the entry mechanism, such as using price approaching the EMA rather than crossing the EMA as a signal * Add volume confirmation or other market internal structure indicators to improve signal quality
Based on code analysis, the following optimization directions can be proposed:
Adaptive Parameters: Implement mechanisms to dynamically adjust pivot lookback periods and EMA length based on market volatility or trend strength, automatically adapting to different market environments
Multi-Timeframe Analysis: Integrate higher timeframe trend confirmation to ensure trading in the direction of the larger trend, avoiding counter-trend trading
Enhanced Trend Confirmation: Consider integrating other trend confirmation indicators beyond the current HH/HL and LH/LL patterns, such as trendlines, moving average slopes, or momentum indicators
Smart Stop Loss Management: Implement trailing stop mechanisms to automatically move stop positions once trades move favorably, protecting profits
Market Volatility Adjustment: Adjust risk-reward ratios and stop distances based on current market volatility, adopting more conservative settings in highly volatile markets
Volume Confirmation: Add volume analysis to ensure sufficient volume supports important price action turning points, increasing signal reliability
Time Filters: Implement time filtering to avoid trading during known low-liquidity or high-volatility periods, such as important news releases or market opening/closing sessions
Optimized Partial Profit Mechanism: The current strategy uses a fixed percentage for partial profits; consider implementing more dynamic approaches that adjust partial profit percentages based on market conditions
These optimizations will help improve the strategy’s robustness, adaptability, and overall performance, especially across different market environments.
The Trend Pullback Professional Strategy is a well-structured trading system that combines the fundamental principles of Dow Theory with modern technical analysis tools. By using market structure to determine trends, EMA to identify pullbacks, and an ADX filter to ensure trend strength, the strategy provides a comprehensive framework for identifying high-probability trading opportunities.
The strategy’s main advantages lie in its objective market structure-based trend identification, clear entry conditions, and dynamic risk management approach. However, users should be aware of potential risks such as trend identification delays, false pullback signals, and parameter sensitivity.
By implementing the suggested optimizations, such as adaptive parameters, multi-timeframe analysis, and enhanced stop-loss management, the strategy can be further improved to enhance its robustness and performance across different market conditions.
Ultimately, the success of any trading strategy depends on thorough backtesting, continuous monitoring, and adjustments when necessary. Traders should ensure comprehensive testing of the strategy on their preferred financial instruments and timeframes before considering any live application.
//@version=5
strategy("Pullback Pro Dow Strategy v7 (ADX Filter)",
shorttitle="Pullback Pro v7 ADX",
overlay=true,
initial_capital=10000,
default_qty_type=strategy.percent_of_equity,
default_qty_value=10,
commission_type=strategy.commission.percent,
commission_value=0.04,
process_orders_on_close=true)
// --- Grouping ---
string GP_DOW = "① Dow Theory Settings"
string GP_ENTRY = "② Entry Logic (Pullback)"
string GP_RISK = "③ Risk & Exit Management"
string GP_FILTER = "④ Filters"
string GP_DISPLAY = "Display Settings"
// --- Dow Theory Settings ---
pivotLookback = input.int(10, title="Pivot Lookback Period", minval=1, group=GP_DOW)
// --- Entry Logic (Pullback) ---
pullbackEmaLength = input.int(21, title="Pullback EMA Length", group=GP_ENTRY, tooltip="このEMAへの価格の接近を「押し目/戻り」と判断します。")
// --- Risk & Exit Management ---
riskRewardRatio1 = input.float(1.5, "Take Profit 1 R:R", minval=0.1, step=0.1, group=GP_RISK, tooltip="TP1のリスクリワード比率")
qtyPercentTP1 = input.int(50, title="Take Profit 1 (%)", minval=1, maxval=100, group=GP_RISK, tooltip="TP1で決済するポジションの割合(%)")
riskRewardRatio2 = input.float(3.0, "Take Profit 2 R:R", minval=0.1, step=0.1, group=GP_RISK, tooltip="TP2のリスクリワード比率")
// --- Filters (Modified from RSI to ADX) ---
useAdxFilter = input.bool(true, title="Use ADX Trend Filter", group=GP_FILTER)
adxLength = input.int(14, "ADX Length", group=GP_FILTER)
adxThreshold = input.float(25, "ADX Threshold", group=GP_FILTER, tooltip="この値よりADXが大きい場合のみエントリーします。")
// --- Display Settings ---
showPivots = input.bool(true, title="Show Pivots", group=GP_DISPLAY)
showEma = input.bool(true, title="Show Pullback EMA", group=GP_DISPLAY)
// --- Indicator Calculations (Modified from RSI to ADX) ---
pivotHighPrice = ta.pivothigh(high, pivotLookback, pivotLookback)
pivotLowPrice = ta.pivotlow(low, pivotLookback, pivotLookback)
pullbackEma = ta.ema(close, pullbackEmaLength)
[diPlus, diMinus, adx] = ta.dmi(adxLength, adxLength) // ADX calculation
// --- Pivot & Trend Determination ---
var float lastPivotHigh = na, var float prevPivotHigh = na
var float lastPivotLow = na, var float prevPivotLow = na
if not na(pivotHighPrice)
prevPivotHigh := lastPivotHigh
lastPivotHigh := pivotHighPrice
if not na(pivotLowPrice)
prevPivotLow := lastPivotLow
lastPivotLow := pivotLowPrice
var int trendDirection = 0
if not na(lastPivotHigh) and not na(prevPivotHigh) and not na(lastPivotLow) and not na(prevPivotLow)
isUptrend = lastPivotHigh > prevPivotHigh and lastPivotLow > prevPivotLow
isDowntrend = lastPivotHigh < prevPivotHigh and lastPivotLow < prevPivotLow
if isUptrend
trendDirection := 1
else if isDowntrend
trendDirection := -1
else
trendDirection := 0
// --- Entry Conditions (Modified from RSI to ADX) ---
bool isUptrendConfirmed = trendDirection == 1
bool isDowntrendConfirmed = trendDirection == -1
bool buyPullback = isUptrendConfirmed and ta.crossunder(low, pullbackEma)
bool sellRally = isDowntrendConfirmed and ta.crossover(high, pullbackEma)
bool adxTrendOk = not useAdxFilter or adx > adxThreshold // ADX filter logic
bool goLong = buyPullback and adxTrendOk
bool goShort = sellRally and adxTrendOk
// --- Strategy State & Risk Management ---
var float stopLossPrice = na
var float takeProfitPrice1 = na
var float takeProfitPrice2 = na
var bool tp1_hit = false
// Entry Logic
if strategy.position_size == 0
tp1_hit := false // Reset TP1 flag on new trade
if goLong
stopLossPrice := lastPivotLow
riskSize = close - stopLossPrice
if riskSize > 0
takeProfitPrice1 := close + (riskSize * riskRewardRatio1)
takeProfitPrice2 := close + (riskSize * riskRewardRatio2)
strategy.entry("L", strategy.long)
if goShort
stopLossPrice := lastPivotHigh
riskSize = stopLossPrice - close
if riskSize > 0
takeProfitPrice1 := close - (riskSize * riskRewardRatio1)
takeProfitPrice2 := close - (riskSize * riskRewardRatio2)
strategy.entry("S", strategy.short)
// ▼▼▼【最終修正版 v7】決済ロジック ▼▼▼
if strategy.position_size > 0 // ロングポジション("L")の決済ロジック
// --- Stop Loss ---
if low <= stopLossPrice
strategy.close("L", comment="SL Hit")
tp1_hit := false
// --- Take Profit 1 ---
if not tp1_hit and high >= takeProfitPrice1
strategy.close("L", comment="TP1 Hit", qty_percent=qtyPercentTP1)
tp1_hit := true
// --- Take Profit 2 ---
if tp1_hit and high >= takeProfitPrice2
strategy.close("L", comment="TP2 Hit")
tp1_hit := false
if strategy.position_size < 0 // ショートポジション("S")の決済ロジック
// --- Stop Loss ---
if high >= stopLossPrice
strategy.close("S", comment="SL Hit")
tp1_hit := false
// --- Take Profit 1 ---
if not tp1_hit and low <= takeProfitPrice1
strategy.close("S", comment="TP1 Hit", qty_percent=qtyPercentTP1)
tp1_hit := true
// --- Take Profit 2 ---
if tp1_hit and low <= takeProfitPrice2
strategy.close("S", comment="TP2 Hit")
tp1_hit := false
// --- Plotting ---
plot(showEma ? pullbackEma : na, "Pullback EMA", color=color.orange)
plotshape(showPivots ? pivotHighPrice : na, style=shape.xcross, location=location.absolute, color=color.red, size=size.tiny)
plotshape(showPivots ? pivotLowPrice : na, style=shape.xcross, location=location.absolute, color=color.blue, size=size.tiny)