ATR 채널 평균 역전 양적 거래 전략

저자:차오장, 날짜: 2023-12-11 15:38:25
태그:

img

전반적인 설명

이 전략은 가격이 ATR 채널의 하단 범위를 넘어서면 엔트리 신호를 식별하고 가격이 ATR 채널의 중단 (EMA) 또는 상단 범위에 도달하면 이익을 취하는 장기 전략입니다. 또한 ATR을 사용하여 스톱 로스 수준을 계산합니다. 이 전략은 빠른 단기 거래에 적합합니다.

전략 논리

가격이 하위 ATR 밴드 아래로 넘어지면 이상 하락을 신호합니다. 전략은 다음 촛불 열 때 긴 거리로 갈 것입니다. 스톱 손실은 입상 가격 빼기 ATR 스톱 손실 곱하기 ATR로 설정됩니다. 이윤을 취하는 것은 중간 밴드 (EMA) 또는 상위 ATR 밴드입니다. 현재 바의 폐쇄가 이전 바의 낮은 것보다 낮다면 이전 바의 낮은 것을 이익으로 사용하십시오.

구체적으로, 핵심 논리는 다음을 포함합니다.

  1. ATR 및 중간 대역 (EMA) 을 계산합니다.
  2. 시간 필터를 정의합니다
  3. 가격 < 하위 ATR 대역 때 긴 신호를 식별
  4. 다음 술집에 들어가면
  5. 기록적인 진입 가격
  6. 스톱 로스 가격 계산
  7. 이윤을 취득할 때 가격 > 중간 범위 (EMA) 또는 상부 ATR 범위
  8. 가격 < 스톱 로스 가격에서 정지

이점 분석

이 전략의 장점:

  1. 신뢰할 수 있는 입출구 신호를 위해 ATR 채널을 사용합니다.
  2. 고도의 추격을 피하는 이상 하락 후에만
  3. 엄격한 스톱 로스 통제 위험
  4. 빠른 단기 거래에 적합합니다
  5. 간단한 논리, 구현하고 최적화하기 쉬운

위험 분석

몇 가지 위험 요소가 있습니다.

  1. 높은 거래 빈도는 더 높은 거래 비용과 미끄러짐으로 이어집니다.
  2. 연속적인 스톱 로스 트리거가 발생할 수 있습니다.
  3. 부적절한 매개 변수 최적화는 성능에 영향을 미칩니다.
  4. 큰 가격 변동은 너무 큰 스톱 로스로 이어질 수 있습니다.

이 위험은 ATR 기간, 스톱 로스 멀티플라이커 등을 조정함으로써 감소 할 수 있습니다. 낮은 거래 수수료를 가진 브로커를 선택하는 것도 중요합니다.

최적화 방향

이 전략은 다음과 같이 개선될 수 있습니다.

  1. 가장 좋은 입력 신호를 놓치지 않도록 다른 필터 표시기를 추가합니다.
  2. ATR 기간 최적화
  3. 재입국 메커니즘을 고려
  4. 적응식 스톱 손실 크기
  5. 트렌드 필터를 추가하여 트렌드 반대 거래를 피합니다.

결론

요약하자면, 이것은 ATR 채널을 기반으로 한 간단하고 실용적인 평균 회귀 전략입니다. 명확한 입시 규칙, 엄격한 스톱 로스 및 합리적인 수익을 취합니다. 또한 매개 변수 조정에도 여지가 있습니다. 거래자가 올바른 기호를 선택하고 스톱 로스로 위험을 제어 할 수 있다면이 전략은 좋은 결과를 얻을 수 있습니다.


/*backtest
start: 2022-12-04 00:00:00
end: 2023-12-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bcullen175

//@version=5
strategy("ATR Mean Reversion", overlay=true, initial_capital=100000,default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=6E-5) // Brokers rate (ICmarkets = 6E-5)
SLx = input(1.5, "SL Multiplier", tooltip = "Multiplies ATR to widen stop on volatile assests, Higher values reduce risk:reward but increase winrate, Values below 1.2 are not reccomended")
src = input(close, title="Source")
period = input.int(10, "ATR & MA PERIOD")
plot(open+ta.atr(period))
plot(open-ta.atr(period))
plot((ta.ema(src, period)), title = "Mean", color=color.white)

i_startTime     = input(title="Start Filter", defval=timestamp("01 Jan 1995 13:30 +0000"), group="Time Filter", tooltip="Start date & time to begin searching for setups")
i_endTime       = input(title="End Filter", defval=timestamp("1 Jan 2099 19:30 +0000"), group="Time Filter", tooltip="End date & time to stop searching for setups")

// Check filter(s)
f_dateFilter = true

atr = ta.atr(period)

// Check buy/sell conditions
var float buyPrice = 0
buyCondition    = low < (open-ta.atr(period)) and strategy.position_size == 0 and f_dateFilter
sellCondition   = (high > (ta.ema(close, period)) and strategy.position_size > 0 and close < low[1]) or high > (open+ta.atr(period))
stopDistance    = strategy.position_size > 0 ? ((buyPrice - atr)/buyPrice) : na
stopPrice       = strategy.position_size > 0 ? (buyPrice - SLx*atr): na
stopCondition   = strategy.position_size > 0 and low < stopPrice

// Enter positions
if buyCondition
    strategy.entry(id="Long", direction=strategy.long)

if buyCondition[1]
    buyPrice := open

// Exit positions
if sellCondition or stopCondition
    strategy.close(id="Long", comment="Exit" + (stopCondition ? "SL=true" : ""))
    buyPrice := na

// Draw pretty colors
plot(buyPrice, color=color.lime, style=plot.style_linebr)
plot(stopPrice, color=color.red, style=plot.style_linebr, offset=-1)


더 많은