이 전략은 켈트너 채널의 중부, 상부 및 하부 레일을 계산합니다. 그것은 중부 및 하부 레일 위에 색을 채웁니다. 채널의 방향을 결정 한 후, 그것은 깨고 구매하고 판매합니다. 그것은 일종의 트렌드 추적 전략입니다.
핵심 지표는 켈트너 채널이다. 채널의 중간 레일은 전형적인 가격 (최고 가격 + 최저 가격 + 종료 가격) /3의 N 일간 가중화 이동 평균이다. 채널의 상부 및 하부 레일은 각각 중간 레일 라인에서 한 거래 범위 N 일간 가중화 이동 평균이다. 거래 범위는 진정한 변동성 ATR을 선택할 수 있거나 진폭 (최고 가격 - 최저 가격) 을 직접 취할 수 있습니다. 후자는이 전략에서 채택됩니다.
구체적으로, 전략은 주로 가격이 상부 레일 또는 하부 레일을 통과하는지 판단하고 중간 레일을 경계로 긴 또는 짧은 결정을 내립니다. 닫기 가격이 상부 레일보다 크다면 길게 가십시오. 닫기 가격이 하위 레일보다 작다면 짧게 가십시오. 스톱 손실 라인은 중간 레일의 MA 값입니다.
일반적으로 이 전략은 비교적 간단하고 직접적이며 일반적인 가격 돌파구 전략이다. 이점은 아이디어가 명확하고 이해하기 쉽고 구현하기 쉽다는 점이며, 초보자도 배울 수 있습니다. 그러나 또한 특정 한계도 있습니다. 매개 변수에 민감하고 결과는 불균형하며 반복적인 테스트와 최적화가 필요합니다. 더 복잡한 판단 지표와 결합 할 수 있다면 더 강력한 거래 전략을 형성 할 수 있습니다.
/*backtest start: 2023-12-01 00:00:00 end: 2023-12-31 23:59:59 period: 1h basePeriod: 15m 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/ // © WMX_Q_System_Trading //@version=3 strategy(title = "WMX Keltner Channels strategy", shorttitle = "WMX Keltner Channels strategy", overlay = true) useTrueRange = input(true) length = input(20, minval=5) mult = input(2.618, minval=0.1) mah =ema(ema( ema(high, length),length),length) mal =ema(ema( ema(low, length),length),length) range = useTrueRange ? tr : high - low rangema =ema(ema( ema(range, length),length),length) upper = mah + rangema * mult lower = mal - rangema * mult ma=(upper+lower)/2 uc = red lc=green u = plot(upper, color=uc, title="Upper") basis=plot(ma, color=yellow, title="Basis") l = plot(lower, color=lc, title="Lower") fill(u, basis, color=uc, transp=95) fill(l, basis, color=lc, transp=95) strategy.entry("Long", strategy.long, stop = upper, when = strategy.position_size <= 0 and close >upper) strategy.entry("Short", strategy.short, stop = lower, when = strategy.position_size >= 0 and close<lower) if strategy.position_size > 0 strategy.exit("Stop Long", "Long", stop = ma) if strategy.position_size < 0 strategy.exit("Stop Short", "Short", stop = ma)