ATR 동적 관리 기반 브레이크아웃 트레이딩 전략 개시

BB EMA RSI ADX ATR
생성 날짜: 2024-11-12 14:26:23 마지막으로 수정됨: 2024-11-12 14:26:23
복사: 1 클릭수: 488
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

ATR 동적 관리 기반 브레이크아웃 트레이딩 전략 개시

개요

이 전략은 다중 기술 지표에 기반한 시장 개시 거래 시스템으로, 주로 독일과 미국 시장 개시 시점을 대상으로 한다. 이 전략은 브린 대역을 통해 정리 단계를 식별하고, 단기 및 장기 지수 이동 평균과 결합하여 트렌드 방향을 확인하고, 상대적으로 강한 지표와 트렌드 방향 지표를 활용하여 거래 신호를 필터링하고, 최종적으로 실제 파도 지표를 사용하여 역동적으로 위치를 관리한다.

전략 원칙

전략은 14주기 브린밴드 ((표준차이의 1.5배) 를 사용하여 낮은 변동 단계를 식별하고, 가격이 브린밴드 중간 궤도에 가까워질 때 평형으로 간주한다. 동시에 10주기 및 200주기 지수 이동 평균을 사용하여 다중 트렌드를 확인하고, 가격이 두 개의 평평선 위에 있어야 한다. 시장이 과매가 되지 않도록 7주기 RSI를 사용하여 7주기 ADX를 사용하여 트렌드 강도를 확인한다.

전략적 이점

  1. 가짜 신호를 줄이기 위한 다중 기술 지표 교차 검증
  2. ATR 기반의 동적 중지, 시장의 변동에 적응
  3. 오픈 시점의 높은 변동성에 집중하라
  4. 강세를 포착하기 위한 종합-파격 모드
  5. 좋은 위험 관리 장치

전략적 위험

  1. 다중 지표로 인해 일부 거래 기회를 놓칠 수 있습니다.
  2. 개시시간의 급격한 변동으로 인해 손실이 발생할 수 있습니다.
  3. 시장의 급격한 전환은 큰 손실을 초래할 수 있습니다. 합리적인 포지션 통제, 엄격한 손실 방지 전략, 과다 거래 방지.

전략 최적화 방향

  1. 다른 시장 특성에 따라 지표 매개 변수를 조정할 수 있습니다.
  2. 거래량 지표가 추가되는 것을 고려해 보세요.
  3. 신호 신뢰성을 높이기 위해 더 많은 기술 지표를 도입
  4. 진입 시점을 최적화하여 미끄러짐 영향을 줄이십시오.
  5. “피해금지 제도를 개선하고 수익률을 높여라”

요약하다

이 전략은 다차원 기술 분석 방법을 통해 상장 시기의 거래 기회를 포착하고, 동적 스톱 로즈 스톱 리스크 관리를 적용한다. 전략 논리는 명확하고, 풍력 관리가 완벽하며, 실용성이 좋다. 지속적인 최적화 및 조정으로 전략 성능을 더욱 향상시킬 수 있다.

전략 소스 코드
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Post-Open Long Strategy with ATR-based Stop Loss and Take Profit (Separate Alerts)", overlay=true)

// Parametri per Bande di Bollinger ed EMA
lengthBB = 14
mult = 1.5  // Bande di Bollinger più strette per timeframe inferiori
emaLength = 10  // EMA più breve per una rilevazione di trend più rapida
emaLongLength = 200  // EMA a lungo termine per il filtraggio del trend

// Parametri per RSI
lengthRSI = 7
rsiThreshold = 30

// Parametri per ADX
adxLength = 7
adxSmoothing = 7
adxThreshold = 10

// Filtro temporale - Solo durante l'apertura dei mercati tedesco e USA
daxOpen = (hour >= 8 and hour < 12)
usOpen = (hour == 15 and minute >= 30) or (hour >= 16 and hour < 19)

// Calcolo delle Bande di Bollinger
smaBB = ta.sma(close, lengthBB)
basis = smaBB
dev = mult * ta.stdev(close, lengthBB)
upperBand = basis + dev
lowerBand = basis - dev

// Calcolo delle EMA (breve e lungo termine)
ema = ta.ema(close, emaLength)  // EMA più breve
emaLong = ta.ema(close, emaLongLength)  // EMA a lungo termine per il filtraggio del trend

// Calcolo RSI
rsi = ta.rsi(close, lengthRSI)

// Calcolo ADX
[plusDI, minusDI, adx] = ta.dmi(adxLength, adxSmoothing)

// Calcolo ATR per Stop Loss e Take Profit dinamici
atrLength = 14
atrStopLossMultiplier = 2.0  // Moltiplicatore per Stop Loss
atrTakeProfitMultiplier = 4.0  // Moltiplicatore per Take Profit modificato a 4.0
atrValue = ta.atr(atrLength)  // Valore ATR calcolato qui

// Condizione di lateralizzazione - Prezzo vicino alla SMA delle Bande di Bollinger
lateralization = math.abs(close - smaBB) < (0.01 * close) and (daxOpen or usOpen)

// Identificazione della resistenza e del breakout
var float resistanceLevel = na
resistanceTouches = 0

for i = 1 to 20
    if high[i] > high[i+1] and high[i] > high[i-1]
        resistanceLevel := high[i]
        resistanceTouches := resistanceTouches + 1

// Condizione di Breakout: Il prezzo attuale supera la resistenza identificata
breakoutCondition = close > resistanceLevel and resistanceTouches >= 2

// Filtro di mercato rialzista a lungo termine - Entrare solo se il prezzo è sopra la EMA a 200 periodi
bullMarket = close > emaLong

// Filtro di trend a breve termine
trendFilter = ta.ema(close, emaLength)  // Filtro di trend a breve termine
trendDown = close < trendFilter  // Condizione di downtrend basata sul trend a breve termine

// Evitare l'entrata durante un pullback - Verifica se le due candele precedenti sono rosse
firstRedCandle = close[1] < open[1]  // La prima candela precedente è rossa
secondRedCandle = close[2] < open[2]  // La seconda candela precedente è rossa
avoidPullbackCondition = not (firstRedCandle and secondRedCandle)  // Entrare solo se non entrambe sono rosse

// Condizione Panic Candle - La candela deve chiudere negativa
panicCandle = close < open and (daxOpen or usOpen)

// Condizione di Entrata Long
longCondition = breakoutCondition and lateralization and close > ema and rsi > rsiThreshold and adx > adxThreshold and not trendDown and avoidPullbackCondition and bullMarket and panicCandle

// Stop Loss e Take Profit dinamici basati su ATR
atrStopLoss = close - (atrValue * atrStopLossMultiplier)  // Stop Loss dinamico usando ATR con moltiplicatore 2.0
atrTakeProfit = close + (atrValue * atrTakeProfitMultiplier)  // Take Profit dinamico usando ATR con moltiplicatore 4.0

// Entrata Long: Ordine eseguito alla chiusura della candela
if (longCondition and strategy.opentrades == 0 and barstate.isconfirmed)
    strategy.entry("Long", strategy.long)

// Disegna linee per Stop Loss e Take Profit
// line.new(x1=bar_index, y1=atrStopLoss, x2=bar_index + 1, y2=atrStopLoss, color=color.red, width=2, style=line.style_solid)  // Linea di Stop Loss (rossa)
// line.new(x1=bar_index, y1=atrTakeProfit, x2=bar_index + 1, y2=atrTakeProfit, color=color.green, width=2, style=line.style_solid)  // Linea di Take Profit (verde)

// Uscita: Stop Loss o Take Profit raggiunti
if (strategy.opentrades > 0)
    strategy.exit("Exit Long", "Long", stop=atrStopLoss, limit=atrTakeProfit)

// Alert: Differenziati per Entrata e Uscita utilizzando strategy.order.action
alert_message = "Azione: {{strategy.order.action}}, Prezzo: {{close}}, Dimensione Posizione: {{strategy.position_size}}"