켈트너 채널 브레이크아웃 리트레이스먼트 전략


생성 날짜: 2023-12-27 14:49:39 마지막으로 수정됨: 2023-12-27 14:49:39
복사: 0 클릭수: 761
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

켈트너 채널 브레이크아웃 리트레이스먼트 전략

개요

이 전략은 켈트너 통로 지표에 기초하여 회수 거래 전략을 설계했다. 이 전략은 가격과 켈트너 통로 상하의 관계를 비교하여 가격이 역전될 수 있는 시점을 판단하고, 적절한 상공 작업을 수행했다.

전략 원칙

이 전략은 켈트너 채널 지표를 사용하여 가격 흐름을 판단한다. 켈트너 채널은 평균선과 평균 실제 파장 (ATR) 으로 구성된다. 채널 상궤는 평균선과 ATR의 N배에 해당하며, 하궤는 평균선에서 ATR의 N배를 니다. 가격이 아래에서 위쪽으로 갈 때, 다중 힘이 증가한다고 생각하면, 더 많은 것을 할 수 있습니다.

또한, 이 전략은 다시 뽑는 기회를 판단하는 근거는 가격이 다시 터치하거나 통로 경계를 뚫는 것입니다. 예를 들어, 가격이 상승한 후 하향 경로를 뚫고, 경로를 건드리지 않고 다시 하향 경로를 건드리는 것입니다. 이것은 여러 번 다시 뽑는 기회입니다. 이 전략은 이 시점에서 더 많은 것을 할 것입니다.

우위 분석

이 전략은 가격 회수 특성을 이용한 거래입니다. 이 전략의 장점은 다음과 같습니다.

  1. 켈트너 통로를 사용하여 가격 추세 방향을 판단하여 잡음을 효과적으로 필터링 할 수 있습니다.
  2. 은 회전하기 전에 현장 안으로 들어가서 더 큰 상황을 잡을 수 있는 회전 전략을 채택한다.

위험 분석

이 전략의 주요 위험은 다음과 같습니다.

  1. 시장이 장기적으로 일방적으로 움직일 때, 회수 기회는 많지 않을 수도 있고, 수익을 얻을 수 없습니다.
  2. 회수 신호 판단이 정확하지 않으면 손실이 발생할 수 있습니다.

대책:

  1. 최적화 매개 변수, 통로 너비 조정, 시장 환경에 적응.
  2. 포지션 관리를 강화하고 단독 손실을 줄여라.

최적화 방향

이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.

  1. 거래량에 따라 돌파구를 필터링하여 가짜 돌파구를 방지합니다.
  2. 변동률에 따라 포지션 크기를 조정하십시오.
  3. 더 많은 수익을 얻기 위해 스톱를 이동하는 새로운 스톱 방법

요약하다

이 전략은 트렌드 판단과 회수 거래의 방법을 통합하여 역전 상황을 포착하는 데 독특한 이점을 가지고 있습니다. 매개 변수 조정과 기능을 확장함으로써 전략의 안정성과 수익성을 더욱 강화 할 수 있습니다.

전략 소스 코드
/*backtest
start: 2023-11-26 00:00:00
end: 2023-12-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("Keltner bounce from border. No repaint. (by Zelibobla)", shorttitle="Keltner border bounce", overlay=true)

price = close

// build Keltner
keltnerLength = input(defval=200, minval=1, title="Keltner EMA Period Length")
keltnerATRLength = input(defval=200, minval=1, title="Keltner ATR Period Length (the same as EMA length in classic Keltner Channels)")
keltnerDeviation = input(defval=8, minval=1, maxval=15, title="Keltner band width (in ATRs)")
closeOnEMATouch = input(type=bool, defval=false, title="Close trade on EMA touch? (less drawdown, but less profit and higher commissions impact)")
enterOnBorderTouchFromInside = input(type=bool, defval=false, title="Enter on border touch from inside? (by default from outside, which is less risky but less profitable)")
SL = input(defval=50, minval=0, maxval=10000, title="Stop loss in ticks (leave zero to skip)")
EMA = sma(price, keltnerLength)
ATR = atr(keltnerATRLength)
top = EMA + ATR * keltnerDeviation
bottom = EMA - ATR * keltnerDeviation

buyEntry = crossover(price, bottom)
sellEntry = crossunder(price, top)
plot(EMA, color=aqua,title="EMA")
p1 = plot(top, color=silver,title="Keltner top")
p2 = plot(bottom, color=silver,title="Keltner bottom")
fill(p1, p2)

tradeSize = input(defval=1, minval=1, title="Trade size")

if ( enterOnBorderTouchFromInside and crossunder(price, bottom) )
    strategy.entry("BUY", strategy.long, qty=tradeSize, comment="BUY")
else
    if( crossover(price, bottom) )
        strategy.entry("BUY", strategy.long, qty=tradeSize, comment="BUY")

if( crossover(price,EMA) and closeOnEMATouch )
    strategy.close("BUY")

if( 0 != SL )
    strategy.exit("EXIT BUY", "BUY", qty=tradeSize, loss=SL)
    strategy.exit("EXIT SELL", "SELL", qty=tradeSize, loss=SL)
   
if( enterOnBorderTouchFromInside and crossover(price, bottom) )
    strategy.entry("SELL", strategy.long, qty=tradeSize, comment="SELL")
else
    if ( crossunder(price, top) )
        strategy.entry("SELL", strategy.short, qty=tradeSize, comment="SELL")
    
    
if( crossunder(price, EMA) and closeOnEMATouch )
    strategy.close("SELL")