ATR 채널 브레이크업 양적 거래 전략

저자:차오장
태그:

img

전반적인 설명

전략 논리

장점

  1. 단순하고 명확한 논리, 이해하기 쉽고 실행하기 쉬운, 지표와 채널 브레이크업에 기반한 직관적인 장기/단기 결정.

위험 분석

가능한 해결책:

  1. MACD, KDJ와 교차 확인을 추가하여 SMA 시스템적 지연 위험을 피합니다.

  2. 트렌드 편향에 대한 전체 시장 체제를 결정합니다. 황소 트렌드 시장에서 길고 곰 트렌드에서 짧습니다.

더 나은 기회

  1. 가짜 브레이크오웃을 줄이기 위해 MACD, KDJ 등을 사용하여 신호를 확인하기 위해 추가 표시 필터를 추가합니다.

요약


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 30m
basePeriod: 15m
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/
// © omererkan

//@version=5
strategy(title="ATR Channel Breakout")

smaLength = input.int(150, title="SMA Length")
atrLength = input.int(30, title="ATR Length")

ubOffset = input.float(4, title="Upperband Offset", step=0.50)
lbOffset = input.float(4, title="Lowerband Offset", step=0.50)


smaValue = ta.sma(close, smaLength)
atrValue = ta.atr(atrLength)

upperBand = smaValue + (ubOffset * atrValue)
lowerBand = smaValue - (lbOffset * atrValue)


plot(smaValue, title="SMA", color=color.orange)
plot(upperBand, title="UB", color=color.green, linewidth=2)
plot(lowerBand, title="LB", color=color.red, linewidth=2)


enterLong = ta.crossover(close, upperBand)
exitLong  = ta.crossunder(close, smaValue)


enterShort = ta.crossunder(close, lowerBand)
exitShort  = ta.crossover(close, smaValue)


if enterLong
    strategy.entry("Long", strategy.long)

if enterShort
    strategy.entry("Short", strategy.short)


if exitLong
    strategy.close("Long", "Close Long")

if exitShort
    strategy.close("Short", "Close Short")

더 많은