ATR Fusion Trend 최적화 모델 전략

ATR SMA TP BP TR SL
생성 날짜: 2024-11-28 17:06:21 마지막으로 수정됨: 2024-11-28 17:06:21
복사: 0 클릭수: 403
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

ATR Fusion Trend 최적화 모델 전략

개요

이 전략은 ATR과 피보나치 수를 가중한 고급 트렌드 추적 시스템이다. 그것은 여러 시간 주기 동안의 변동률 분석과 피보나치 가중 평균을 결합하여 민감하고 적응력이 강한 거래 모델을 구축한다. 이 전략의 핵심은 동적 중량을 배분하여 시장 추세를 더 잘 포착하고 ATR을 사용하여 정확한 수익을 창출하는 것이다.

전략 원칙

전략은 다단계 기술 지표 조합 방법을 사용합니다: 먼저 실제 변동 범위 ((TR) 와 구매 압력 ((BP) 를 계산하고 피보나치 수열 시간 주기 ((8,13,21,34,55) 에 기반한 각 주기의 압력 비율을 계산합니다. 다른 주기에 다른 무게를 적용하여 중화 된 평균을 구성하고 3 주기의 SMA 평준화를 추가로 적용합니다. 시스템은 SMA와 사전 설정된 스레드값 ((58.0 및 42.0) 의 교차에 따라 거래 신호를 유발하고 ATR을 사용하여 4 단계의 수익 결제 메커니즘을 설계합니다.

전략적 이점

  1. 다차원 분석: 여러 시기의 데이터를 결합하여 더 포괄적인 시장 관점을 제공합니다.
  2. 동적 적응: ATR을 통해 시장의 변동에 적응하여 전략적 안정성을 높인다.
  3. 스마트 수익: 4단계 수익 메커니즘은 다양한 시장 환경에 따라 유연하게 조정할 수 있습니다.
  4. 위험 통제: 입출장 조건이 명확하여 주관적 판단으로 인한 위험을 줄입니다.
  5. 체계화 된 운영: 전략 논리가 명확하고, 양적으로 구현하기 쉽고, 재검토 검증

전략적 위험

  1. 변수 감수성: 여러 값과 무게 변수들은 신중하게 조정해야 한다.
  2. 지연 위험: SMA 평형이 신호 지연을 유발할 수 있다.
  3. 시장 환경 의존성: 흔들리는 시장에서 잘못된 신호를 낼 수 있다.
  4. 매개 변수 적합성: 다른 시장 조건에 매개 변수가 다시 최적화되어야 합니다. 해결책: 충분한 변수 최적화 및 재검토를 수행하고, 다른 시장 단계에 따라 변수를 동적으로 조정하는 것이 좋습니다.

전략 최적화 방향

  1. 매개 변수 적응: 매개 변수 적응 조정 메커니즘을 개발하여 전략 적응력을 향상시킵니다.
  2. 시장 필터링: 시장 환경을 인식하는 모듈을 추가하여 적절한 시장 조건에서 거래를 수행합니다.
  3. 신호 최적화: 보조 확인 지표를 도입하여 신호 신뢰성을 향상
  4. 풍력 제어 강화: 동적 스톱 로즈 및 포지션 관리 모듈을 추가
  5. 철수 제어: 최대 철수 제한을 추가하여 전략의 안정성을 높인다.

요약하다

이 전략은 ATR과 피보나치 가중 평균 기술을 통합하여 종합적인 트렌드 추적 시스템을 구축한다. 이 전략의 장점은 다차원 분석과 동적 적응력이지만, 또한 매개 변수 최적화 및 시장 환경 필터링에 주의를 기울여야 한다. 지속적인 최적화 및 풍력 조절 강화로 전략은 다양한 시장 환경에서 안정적인 성능을 유지할 것으로 보인다.

전략 소스 코드
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PresentTrading

// The Fibonacci ATR Fusion Strategy is an advanced trading methodology that uniquely integrates Fibonacci-based weighted averages with the Average True Range (ATR) to 
// identify and exploit significant market trends. Unlike traditional strategies that rely on single indicators or fixed parameters, this approach leverages multiple timeframes and 
// dynamic volatility measurements to enhance accuracy and adaptability. 

//@version=5
strategy("Fibonacci ATR Fusion - Strategy [presentTrading]", overlay=false, precision=3, commission_value= 0.1, commission_type=strategy.commission.percent, slippage= 1, currency=currency.USD, default_qty_type = strategy.percent_of_equity, default_qty_value = 10, initial_capital=10000)

// Calculate True High and True Low
tradingDirection = input.string(title="Trading Direction", defval="Both", options=["Long", "Short", "Both"])

// Trading Condition Thresholds
long_entry_threshold = input.float(58.0, title="Long Entry Threshold")
short_entry_threshold = input.float(42.0, title="Short Entry Threshold")
long_exit_threshold = input.float(42.0, title="Long Exit Threshold")
short_exit_threshold = input.float(58.0, title="Short Exit Threshold")

// Enable or Disable 4-Step Take Profit
useTakeProfit = input.bool(false, title="Enable 4-Step Take Profit")

// Take Profit Levels (as multiples of ATR)
tp1ATR = input.float(3.0, title="Take Profit Level 1 ATR Multiplier")
tp2ATR = input.float(8.0, title="Take Profit Level 2 ATR Multiplier")
tp3ATR = input.float(14.0, title="Take Profit Level 3 ATR Multiplier")

// Take Profit Percentages
tp1_percent = input.float(12.0, title="TP Level 1 Percentage", minval=0.0, maxval=100.0)
tp2_percent = input.float(12.0, title="TP Level 2 Percentage", minval=0.0, maxval=100.0)
tp3_percent = input.float(12.0, title="TP Level 3 Percentage", minval=0.0, maxval=100.0)

true_low = math.min(low, close[1])
true_high = math.max(high, close[1])

// Calculate True Range
true_range = true_high - true_low

// Calculate BP (Buying Pressure)
bp = close - true_low

// Calculate ratios for different periods
calc_ratio(len) =>
    sum_bp = math.sum(bp, len)
    sum_tr = math.sum(true_range, len)
    100 * sum_bp / sum_tr

// Calculate weighted average of different timeframes
weighted_avg = (5 * calc_ratio(8) + 4 * calc_ratio(13) + 3 * calc_ratio(21) + 2 * calc_ratio(34) + calc_ratio(55)) / (5 + 4 + 3 + 2 + 1)
weighted_avg_sma = ta.sma(weighted_avg,3)

// Plot the indicator
plot(weighted_avg, "Fibonacci ATR", color=color.blue, linewidth=2)
plot(weighted_avg_sma, "SMA Fibonacci ATR", color=color.yellow, linewidth=2)

// Define trading conditions
longCondition = ta.crossover(weighted_avg_sma, long_entry_threshold)  // Enter long when weighted average crosses above threshold
shortCondition = ta.crossunder(weighted_avg_sma, short_entry_threshold) // Enter short when weighted average crosses below threshold
longExit = ta.crossunder(weighted_avg_sma, long_exit_threshold)
shortExit = ta.crossover(weighted_avg_sma, short_exit_threshold)


atrPeriod = 14
atrValue = ta.atr(atrPeriod)

if (tradingDirection == "Long" or tradingDirection == "Both")
    if (longCondition)
        strategy.entry("Long", strategy.long)
        // Set Take Profit levels for Long positions
        if useTakeProfit
            tpPrice1 = strategy.position_avg_price + tp1ATR * atrValue
            tpPrice2 = strategy.position_avg_price + tp2ATR * atrValue
            tpPrice3 = strategy.position_avg_price + tp3ATR * atrValue
            // Close partial positions at each Take Profit level
            strategy.exit("TP1 Long", from_entry="Long", qty_percent=tp1_percent, limit=tpPrice1)
            strategy.exit("TP2 Long", from_entry="Long", qty_percent=tp2_percent, limit=tpPrice2)
            strategy.exit("TP3 Long", from_entry="Long", qty_percent=tp3_percent, limit=tpPrice3)
    if (longExit)
        strategy.close("Long")

if (tradingDirection == "Short" or tradingDirection == "Both")
    if (shortCondition)
        strategy.entry("Short", strategy.short)
        // Set Take Profit levels for Short positions
        if useTakeProfit
            tpPrice1 = strategy.position_avg_price - tp1ATR * atrValue
            tpPrice2 = strategy.position_avg_price - tp2ATR * atrValue
            tpPrice3 = strategy.position_avg_price - tp3ATR * atrValue
            // Close partial positions at each Take Profit level
            strategy.exit("TP1 Short", from_entry="Short", qty_percent=tp1_percent, limit=tpPrice1)
            strategy.exit("TP2 Short", from_entry="Short", qty_percent=tp2_percent, limit=tpPrice2)
            strategy.exit("TP3 Short", from_entry="Short", qty_percent=tp3_percent, limit=tpPrice3)
    if (shortExit)
        strategy.close("Short")