다우 이론 추세 적응 모멘텀 전략

DTTAS HH/HL LH/LL SL/TP TTS
생성 날짜: 2025-04-03 13:05:17 마지막으로 수정됨: 2025-04-03 13:05:17
복사: 0 클릭수: 359
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

다우 이론 추세 적응 모멘텀 전략 다우 이론 추세 적응 모멘텀 전략

개요

다우시 이론의 트렌드 자율 동력 전략은 고전 다우시 이론의 원칙에 기초한 고급 거래 방법이며, 시장 추세의 중요한 전환점을 식별하여 거래 결정을 안내합니다. 이 전략은 가격 추세의 기본 역학을 탐지하고 확인하는 데 초점을 맞추고 있으며, 더 높은 고위 (Higher Highs) 와 더 높은 낮은 (Higher Lows) 를 사용하여 상승 추세를 정의하고, 더 낮은 고위 (Lower Highs) 와 더 낮은 낮은 (Lower Lows) 를 사용하여 하향 추세를 정의합니다.

전략 원칙

이 전략의 핵심 원칙은 다우시 이론의 고전적 경향 식별 방법을 기반으로 한다. 전략은 ta.pivothigh() 와 ta.pivotlow() 함수를 사용하여 중요한 전환점을 검출한다. 구체적인 구현에는 다음과 같은 중요한 단계가 포함된다:

  1. 전환점 검출: 피벗 룩백 파라미터를 사용하여 좌우 양쪽의 기둥 수를 확인하여 높은 점과 낮은 점을 식별한다.
  2. 트렌드 확인: 더 높은 최고점과 더 높은 낮은 조건이 동시에 충족될 때만 상승 트렌드가 확인된다. 마찬가지로, 더 낮은 최고점과 더 낮은 낮은 조건이 동시에 충족될 때만 하향 트렌드가 확인된다.
  3. 트렌드 지속성: 트렌드 전환 조건이 충족되지 않은 경우, 전략은 이전 트렌드 상태를 유지하여 더 부드러운 트렌드 추적을 구현합니다.

전략적 이점

  1. 동적 트렌드 식별: 전략은 중요한 전환점을 지속적으로 분석하여 시장 추세 변화를 동적으로 포착 할 수 있습니다.
  2. 유연한 거래 모드: 자동으로 거래하는 3가지의 거래 모드를 제공하여 다양한 거래자의 요구를 충족시킵니다.
  3. 리스크 관리: 내장된 스포드 및 스톱 메커니즘으로 단일 거래의 위험을 효과적으로 제어할 수 있다.
  4. 시각화 트렌드: 배경 색상과 표시를 통해 트렌드 방향을 직관적으로 표시하여 거래자가 시장 상태를 빠르게 이해할 수 있도록합니다.
  5. 낮은 지연: 이 방법은 전통적인 이동 평균 전략에 비해 트렌드 변화에 더 빠르게 반응한다.

전략적 위험

  1. 뒤떨어진 위험: 전환점 검사를 사용함에 따라 전략에 내재된 뒤떨어진 위험은 트렌드의 초기 신호를 잡지 못할 수 있습니다.
  2. 불안정 시장 위험: 변동성이 보이지 않는 시장에서 빈번한 소규모 가격 변동으로 인해 불필요한 거래가 발생할 수 있습니다.
  3. 변수 민감성: pivotLookback 변수의 선택은 전략 성능에 큰 영향을 미치며, 다른 시장과 시간 프레임에 따라 조정해야 한다.
  4. 거래 비용: 거래의 빈도는 높은 거래 비용으로 이어질 수 있습니다.

전략 최적화 방향

  1. 부가적인 필터를 도입: 트렌드 강도 지표 (ATR와 같은) 와 결합하여 약한 트렌드 신호를 필터링한다.
  2. 동적 변수 조정: 시장의 변동성에 기반한 자율적 피벗 룩백 변수 메커니즘을 개발한다.
  3. 다중 시간 프레임 검증: 트렌드 신호를 다른 시간 프레임에서 교차 검증하여 신호의 신뢰성을 높인다.
  4. 기계 학습 강화: 트렌드 식별과 진입 시기를 최적화하기 위해 기계 학습 알고리즘을 사용하는 방법을 탐구한다.
  5. 리스크 관리 최적화: 시장의 변동성에 따라 중지 손실 및 중지 거리를 조정합니다.

요약하다

다우시 이론의 트렌드 자기 적응 동력 전략은 강력한 트렌드 추적 방법이며, 혁신적인 전환점 분석 기술을 통해 거래자에게 체계화된 트렌드 식별 도구를 제공합니다. 일부 고유한 위험이 있음에도 불구하고, 그것의 유연성과 역동성은 현대적인 양적 거래 전략의 가치있는 방법으로 만듭니다. 이 전략을 성공적으로 적용하려면 작동 원리를 깊이 이해하고 특정 시장 환경에 따라 지속적으로 최적화하고 조정해야합니다.

Overview

The Dow Theory Trend Adaptive Momentum Strategy is an advanced trading approach based on classic Dow Theory principles, designed to guide trading decisions by identifying key turning points in market trends. The strategy focuses on detecting and confirming the fundamental dynamics of price trends, using Higher Highs and Higher Lows to define uptrends, and Lower Highs and Lower Lows to define downtrends. This method aims to provide a systematic approach to capturing market trends and responding promptly when trends change.

Strategy Principles

The core principle of this strategy is based on the classic Dow Theory trend identification method. The strategy detects key turning points using ta.pivothigh() and ta.pivotlow() functions. Specific implementation includes the following key steps:

  1. Turning Point Detection: Use the pivotLookback parameter to determine the number of bars on both sides for identifying highs and lows.
  2. Trend Confirmation: An uptrend is confirmed only when both Higher Highs and Higher Lows conditions are met; similarly, a downtrend is confirmed only when both Lower Highs and Lower Lows conditions are satisfied.
  3. Trend Persistence: If trend conversion conditions are not met, the strategy maintains the previous trend state, achieving smoother trend tracking.

Strategy Advantages

  1. Dynamic Trend Identification: By continuously analyzing key turning points, the strategy can dynamically capture market trend changes.
  2. Flexible Trading Modes: Provides three trading modes - automatic, long-only, and short-only - to meet different traders’ needs.
  3. Risk Management: Built-in stop-loss and take-profit mechanisms effectively control the risk of individual trades.
  4. Trend Visualization: Intuitively displays trend direction through background colors and markers, making it easy for traders to understand market conditions.
  5. Low Latency: Compared to traditional moving average strategies, this method can respond to trend changes more quickly.

Strategy Risks

  1. Lag Risk: Due to using pivot point detection, the strategy inherently carries a lag risk and may not capture the earliest trend signals.
  2. Ranging Market Risk: In markets with unclear fluctuations, frequent small price changes may lead to unnecessary trades.
  3. Parameter Sensitivity: The choice of pivotLookback parameter significantly impacts strategy performance and requires adjustment for different markets and timeframes.
  4. Trading Costs: Frequent trading may result in high transaction costs, especially with higher commission rates.

Strategy Optimization Directions

  1. Introduce Additional Filters: Combine trend strength indicators (such as ATR) to filter weak trend signals.
  2. Dynamic Parameter Adjustment: Develop an adaptive pivotLookback parameter mechanism based on market volatility.
  3. Multi-Timeframe Verification: Cross-verify trend signals across different timeframes to improve signal reliability.
  4. Machine Learning Enhancement: Explore using machine learning algorithms to optimize trend identification and entry timing.
  5. Risk Management Optimization: Dynamically adjust stop-loss and take-profit distances based on market volatility.

Conclusion

The Dow Theory Trend Adaptive Momentum Strategy is a powerful trend-following method that provides traders with a systematic trend identification tool through innovative turning point analysis techniques. Despite some inherent risks, its flexibility and dynamism make it a valuable approach in modern quantitative trading strategies. Successfully applying this strategy requires a deep understanding of its working principles and continuous optimization and adjustment based on specific market environments.

전략 소스 코드
/*backtest
start: 2025-03-29 00:00:00
end: 2025-03-30 09:00:00
period: 2m
basePeriod: 2m
exchanges: [{"eid":"Futures_Binance","currency":"BNB_USDT"}]
*/

//@version=5
// strategy(title="Dow Theory Trend Strategy v3", shorttitle="Dow Trend Strat v3", overlay=true,
//      initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10,
//      commission_type=strategy.commission.percent, commission_value=0.1, // Example strategy settings with commission
//      process_orders_on_close=true) // Consider processing on bar close for more stable backtests
strategy(title="Dow Theory Trend Strategy v3", shorttitle="Dow Trend Strat v3", overlay=true) // Basic strategy settings

// --- 設定 ---
// Calculation Settings
pivotLookback = input.int(10, title="Pivot Lookback Period", minval=1, tooltip="ピボットハイ/ローを検出するための左右のバーの数", group="Calculation Settings")

// Display Settings
showPivotPoints = input.bool(true, title="Show Pivot Points", tooltip="ピボットハイ/ローのポイントを表示します", group="Display Settings")
showTrendChange = input.bool(true, title="Show Trend Change Signals", tooltip="トレンド転換のシグナル(エントリーポイント)を表示します", group="Display Settings")

// Strategy Settings
// --- Manual Trend Override (配列定義を input 内に変更) ---
manualTrendMode = input.string("Auto", title="Manual Trend Mode",
     options=["Auto", "Long Only", "Short Only"], // オプションをここで直接定義
     tooltip="手動でトレード方向を指定 (Auto: ダウ理論に従う, Long Only: ロングのみ, Short Only: ショートのみ)",
     group="Strategy Settings")

// Risk Management Settings
useStopLoss = input.bool(true, title="Use Stop Loss", group="Risk Management")
stopLossTicks = input.float(100, title="Stop Loss (Ticks)", minval=1, group="Risk Management", tooltip="エントリー価格からのストップロスまでのティック(最小値動き)数。例:EURUSDで20 pips (tick=0.00001)なら200。")
useTakeProfit = input.bool(true, title="Use Take Profit", group="Risk Management")
takeProfitTicks = input.float(200, title="Take Profit (Ticks)", minval=1, group="Risk Management", tooltip="エントリー価格からのテイクプロフィットまでのティック(最小値動き)数。例:EURUSDで40 pips (tick=0.00001)なら400。")

// --- ピボットハイ/ローの検出 ---
pivotHighPrice = ta.pivothigh(high, pivotLookback, pivotLookback)
pivotLowPrice = ta.pivotlow(low, pivotLookback, pivotLookback)

// --- ピボットポイントの値を保持するための変数 ---
var float lastPivotHigh = na
var float prevPivotHigh = na
var float lastPivotLow = na
var float prevPivotLow = na
var int lastPivotHighBar = na
var int prevPivotHighBar = na
var int lastPivotLowBar = na
var int prevPivotLowBar = na

// --- 新しいピボットが確定したかどうかの検出と値の更新 ---
if not na(pivotHighPrice)
    if na(lastPivotHigh) or pivotHighPrice != lastPivotHigh
        prevPivotHigh := lastPivotHigh
        prevPivotHighBar := lastPivotHighBar
        lastPivotHigh := pivotHighPrice
        lastPivotHighBar := bar_index - pivotLookback

if not na(pivotLowPrice)
    if na(lastPivotLow) or pivotLowPrice != lastPivotLow
        prevPivotLow := lastPivotLow
        prevPivotLowBar := lastPivotLowBar
        lastPivotLow := pivotLowPrice
        lastPivotLowBar := bar_index - pivotLookback

// --- ダウ理論に基づくトレンド判定 (改良版) ---
var int trendDirection = 0
bool hasEnoughPivots = not na(lastPivotHigh) and not na(prevPivotHigh) and not na(lastPivotLow) and not na(prevPivotLow)

if hasEnoughPivots
    isHigherHigh = lastPivotHigh > prevPivotHigh
    isHigherLow = lastPivotLow > prevPivotLow
    isUptrendConfirmed = isHigherHigh and isHigherLow

    isLowerHigh = lastPivotHigh < prevPivotHigh
    isLowerLow = lastPivotLow < prevPivotLow
    isDowntrendConfirmed = isLowerHigh and isLowerLow

    if isUptrendConfirmed
        trendDirection := 1
    else if isDowntrendConfirmed
        trendDirection := -1
    else
        trendDirection := trendDirection[1]

// --- トレンド転換の検出 ---
bool trendChanged = ta.change(trendDirection) != 0
bool changedToUp = trendChanged and trendDirection == 1
bool changedToDown = trendChanged and trendDirection == -1

// --- 描画処理 ---
bgcolor(trendDirection == 1 ? color.new(color.blue, 85) : trendDirection == -1 ? color.new(color.red, 85) : color.new(color.gray, 90), title="Trend Background")
plotshape(showPivotPoints and not na(pivotHighPrice), title="Pivot High", location=location.abovebar, color=color.new(color.maroon, 20), style=shape.triangledown, size=size.tiny, offset=-pivotLookback)
plotshape(showPivotPoints and not na(pivotLowPrice), title="Pivot Low", location=location.belowbar, color=color.new(color.navy, 20), style=shape.triangleup, size=size.tiny, offset=-pivotLookback)
plotshape(showTrendChange and changedToUp, title="Uptrend Start Signal", location=location.belowbar, color=color.new(color.green, 0), style=shape.labelup, text="▲ UP", textcolor=color.white, size=size.small)
plotshape(showTrendChange and changedToDown, title="Downtrend Start Signal", location=location.abovebar, color=color.new(color.red, 0), style=shape.labeldown, text="▼ DOWN", textcolor=color.white, size=size.small)

// --- ストラテジーロジック ---
bool allowLong = manualTrendMode == "Auto" or manualTrendMode == "Long Only"
bool allowShort = manualTrendMode == "Auto" or manualTrendMode == "Short Only"

if (changedToUp and allowLong)
    strategy.entry("L", strategy.long, comment="Go Long")
    if (useStopLoss or useTakeProfit)
        float slValue = useStopLoss and stopLossTicks > 0 ? stopLossTicks : na
        float tpValue = useTakeProfit and takeProfitTicks > 0 ? takeProfitTicks : na
        strategy.exit("LX", from_entry="L", loss=slValue, profit=tpValue, comment_loss="SL Long", comment_profit="TP Long")

if (changedToDown and allowShort)
    strategy.entry("S", strategy.short, comment="Go Short")
    if (useStopLoss or useTakeProfit)
        float slValue = useStopLoss and stopLossTicks > 0 ? stopLossTicks : na
        float tpValue = useTakeProfit and takeProfitTicks > 0 ? takeProfitTicks : na
        strategy.exit("SX", from_entry="S", loss=slValue, profit=tpValue, comment_loss="SL Short", comment_profit="TP Short")

// --- デバッグ用 ---
// plot(trendDirection, title="Trend Direction Value")