지원 수준 돌파에 기반한 동적 ATR 추세 추종 전략

ATR EMA SMC
생성 날짜: 2024-12-12 17:26:00 마지막으로 수정됨: 2024-12-12 17:26:00
복사: 3 클릭수: 399
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

지원 수준 돌파에 기반한 동적 ATR 추세 추종 전략

개요

이것은 지지를 뚫는 것을 기반으로 한 동적 ATR 트렌드 추적 전략이다. 이 전략은 EMA 평균선 시스템, ATR 변동률 지표 및 스마트 펀드 개념 (SMC) 을 통합하여 시장 트렌드를 포착한다. 전략은 포지션 크기와 스톱 포지션을 동적으로 계산하여 좋은 위험 관리를 구현한다.

전략 원칙

이 전략은 다음과 같은 몇 가지 핵심 구성 요소에 기반을 두고 있습니다.

  1. 50 및 200 주기의 EMA 평균선 시스템을 사용하여 시장 추세 방향을 확인합니다.
  2. ATR 지표의 동적 조정으로 스톱로스 및 수익 목표
  3. 주문 블록과 불균형 영역 분석을 통해 최적의 입시 지점을 찾습니다.
  4. 계좌 리스크 비율에 따라 자동으로 계산된 포지션 수
  5. 20 K선 가까이의 변동 범위를 관찰하여 시장이 평형 상태인지 판단합니다.

전략적 이점

  1. 리스크 관리가 잘 되어 있으며, 동적 계산으로 거래의 위험을 통제할 수 있습니다.
  2. 트렌드 판단 시스템이 신뢰성 있고, 시장의 거래를 정리하는 것을 피합니다.
  3. 상쇄장치 설정은 합리적이고, 위험과 이익의 비율은 1:3입니다.
  4. 시장의 변동성을 충분히 고려하여 다양한 시장 환경에 적응할 수 있습니다.
  5. 코드 구조가 명확하고 유지 관리 및 최적화가 쉽습니다.

전략적 위험

  1. EMA 지표의 지연성으로 인해 입시 시기가 지연될 수 있습니다.
  2. 시장의 급격한 변동 속에서 잘못된 신호를 유발할 수 있습니다.
  3. 트렌드 지속성에 의존하는 전략으로, 불안정한 시장에서는 좋지 않을 수 있습니다.
  4. Stop Loss 포지션은 넓고, 경우에 따라서는 큰 손실을 감수할 수 있습니다.

전략 최적화 방향

  1. 양과 가격의 관계를 분석하여 추세를 판단하는 정확도를 높일 수 있습니다.
  2. 시장 정서 지표를 늘리고 진입 시기를 최적화할 수 있습니다.
  3. 시스템 안정성을 높이기 위해 다중 시간 주기의 분석을 고려하십시오.
  4. 주문 블록과 불균형 영역을 정밀화할 수 있는 판단 기준
  5. 손해배상 방법을 최적화하고 이동 손해배상을 고려합니다.

요약하다

이 전략은 합리적인 위험 관리와 여러 신호 확인을 통해 거래의 안정성을 향상시키는 보다 완전한 트렌드 추적 시스템이다. 약간의 뒤처짐이 있지만, 전체적으로 신뢰할 수있는 거래 시스템이다. 실제 사용 전에 충분한 피드백 검증을 수행하고 특정 거래 품종과 시장 환경에 따라 파라미터를 최적화하는 것이 좋습니다.

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

// TradingView Pine Script strategy for Smart Money Concept (SMC)
//@version=5
strategy("Smart Money Concept Strategy", overlay=true, default_qty_type=strategy.fixed, default_qty_value=100)

// === Input Parameters ===
input_risk_percentage = input.float(1, title="Risk Percentage", step=0.1)
input_atr_length = input.int(14, title="ATR Length")
input_ema_short = input.int(50, title="EMA Short")
input_ema_long = input.int(200, title="EMA Long")

// === Calculations ===
atr = ta.atr(input_atr_length)
ema_short = ta.ema(close, input_ema_short)
ema_long = ta.ema(close, input_ema_long)

// === Utility Functions ===
// Identify Order Blocks
is_order_block(price, direction) =>
    ((high[1] > high[2] and low[1] > low[2] and direction == 1) or (high[1] < high[2] and low[1] < low[2] and direction == -1))

// Identify Imbalance Zones
is_imbalance() =>
    range_high = high[1]
    range_low = low[1]
    range_high > close and range_low < close

// Calculate Lot Size Based on Risk
calculate_lot_size(stop_loss_points, account_balance) =>
    risk_amount = account_balance * (input_risk_percentage / 100)
    lot_size = risk_amount / (stop_loss_points * syminfo.pointvalue)
    lot_size

// Determine if Market is Consolidating
is_consolidating() =>
    (ta.highest(high, 20) - ta.lowest(low, 20)) / atr < 2

// === Visual Enhancements ===
// Plot Order Blocks
// if is_order_block(close, 1)
//     line.new(x1=bar_index[1], y1=low[1], x2=bar_index, y2=low[1], color=color.green, width=2, extend=extend.right)
// if is_order_block(close, -1)
//     line.new(x1=bar_index[1], y1=high[1], x2=bar_index, y2=high[1], color=color.red, width=2, extend=extend.right)

// Highlight Imbalance Zones
// if is_imbalance()
//     box.new(left=bar_index[1], top=high[1], right=bar_index, bottom=low[1], bgcolor=color.new(color.orange, 80))

// === Logic for Trend Confirmation ===
is_bullish_trend = ema_short > ema_long
is_bearish_trend = ema_short < ema_long

// === Entry Logic ===
account_balance = strategy.equity
if not is_consolidating()
    if is_bullish_trend
        stop_loss = close - atr * 2
        take_profit = close + (math.abs(close - (close - atr * 2)) * 3)
        stop_loss_points = math.abs(close - stop_loss) / syminfo.pointvalue
        lot_size = calculate_lot_size(stop_loss_points, account_balance)
        strategy.entry("Buy", strategy.long, qty=lot_size)
        strategy.exit("TP/SL", "Buy", stop=stop_loss, limit=take_profit)

    if is_bearish_trend
        stop_loss = close + atr * 2
        take_profit = close - (math.abs(close - (close + atr * 2)) * 3)
        stop_loss_points = math.abs(close - stop_loss) / syminfo.pointvalue
        lot_size = calculate_lot_size(stop_loss_points, account_balance)
        strategy.entry("Sell", strategy.short, qty=lot_size)
        strategy.exit("TP/SL", "Sell", stop=stop_loss, limit=take_profit)

// === Plotting Indicators ===
plot(ema_short, color=color.blue, title="EMA 50")
plot(ema_long, color=color.orange, title="EMA 200")
plotshape(series=is_bullish_trend and not is_consolidating(), style=shape.triangleup, location=location.belowbar, color=color.green, text="Buy")
plotshape(series=is_bearish_trend and not is_consolidating(), style=shape.triangledown, location=location.abovebar, color=color.red, text="Sell")