캔들리어 출구 전략

저자:차오장, 날짜: 2024-01-05 15:57:51
태그:

img

전반적인 설명

이 전략은 캔들리어 출구 지표를 사용하여 가격 파업의 방향과 동력을 결정하고 구매 및 판매 신호를 생성합니다. 그것은 단지 구매 거래를 수행합니다.

전략 논리

이 전략은 가장 높은 최고, 가장 낮은 최저 및 평균 진정한 범위를 기반으로 스톱 손실 라인을 설정하는 캔들리어 출구 지표에 기반합니다. 구체적으로, 22 일 ATR를 계산하고 계수 (예정 3) 로 곱하여 긴 및 짧은 스톱 라인의 값을 도출합니다. 이 전략은 가격이 긴 스톱 아래로 넘어갈 때 판매 신호를 생성하고, 가격이 짧은 스톱 위에 넘어갈 때 구매 신호를 생성합니다.

이 전략은 구매작업만을 수행합니다. 가격이 이전 긴 스톱 라인을 넘어서면 긴 엔트리를 유발하고 가격이 짧은 스톱 라인을 넘어서면 출구 신호를 생성하여 긴 포지션을 닫습니다.

이점 분석

  • 리스크를 효과적으로 제어하기 위해 Chandelier Exit에서 동적 스톱 로스 라인을 사용합니다.
  • 트렌드 움직임을 포착하기 위해 가격 브레이크를 결합합니다
  • 단지 구매로 상승/하락 역전을 피하는 전략을 실행
  • 경고 조건은 전략 상태를 모니터링하기 위한 알림을 유발합니다.

위험 분석

  • Chandelier Exit는 잘못된 신호를 유발할 수 있는 변동성 확장에 민감합니다.
  • 손해 제한을 위한 구매 후 스톱 로스가 없는 경우
  • 이윤을 확보하기 위한 이윤 취득 메커니즘은 없습니다.

위험 완화:

  1. 잘못된 신호를 피하기 위해 다른 표시기와 필터를 추가
  2. 최대 손실 %를 제한하기 위해 스톱 로스를 구현합니다.
  3. 판매 라인의 동적 조정 또는 부분 출구와 같은 후속 수익 중지 사항을 포함합니다.

더 나은 기회

  1. 입력 및 출구를 최적화하기 위해 다른 매개 변수 세트를 테스트
  2. 신호를 확인하고 잘못된 신호를 피하기 위해 표시 필터를 추가
  3. 구매 및 판매 모두 허용 고려
  4. 스톱 로스 및 수익 취득 메커니즘을 도입

결론

이 전략은 캔들리어 출구 지표의 동적 스톱 라인을 사용하여 반전 기회를 식별합니다. 그것은 긴 스톱 라인의 상향 파업에 구매하고 가격이 짧은 스톱 라인 아래에 떨어지면 판매하여 상향 / 하향 반전을 피하는 간단한 일방적인 전략을 구현합니다. 그것은 위험을 효과적으로 제어하지만 스톱 손실 및 수익 조항이 없습니다. 최적화 기회는 필터와 스톱 손실 / 수익 취득 메커니즘을 추가하여 전략을 더 견고하게합니다.


/*backtest
start: 2023-12-28 00:00:00
end: 2024-01-04 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Chandelier Exit Strategy", overlay=true)

length = input(title='ATR Period', defval=22)
mult = input.float(title='ATR Multiplier', step=0.1, defval=3.0)
showLabels = input(title='Show Buy/Sell Labels ?', defval=true)
useClose = input(title='Use Close Price for Extremums ?', defval=true)
highlightState = input(title='Highlight State ?', defval=true)

atr = mult * ta.atr(length)

longStop = (useClose ? ta.highest(close, length) : ta.highest(length)) - atr
longStopPrev = nz(longStop[1], longStop)
longStop := close[1] > longStopPrev ? math.max(longStop, longStopPrev) : longStop

shortStop = (useClose ? ta.lowest(close, length) : ta.lowest(length)) + atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := close[1] < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop

var int dir = 1
dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir

var color longColor = color.green
var color shortColor = color.red

longStopPlot = plot(dir == 1 ? longStop : na, title='Long Stop', style=plot.style_linebr, linewidth=2, color=color.new(longColor, 0))
buySignal = dir == 1 and dir[1] == -1
plotshape(buySignal ? longStop : na, title='Long Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(longColor, 0))
plotshape(buySignal and showLabels ? longStop : na, title='Buy Label', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(longColor, 0), textcolor=color.new(color.white, 0))

shortStopPlot = plot(dir == 1 ? na : shortStop, title='Short Stop', style=plot.style_linebr, linewidth=2, color=color.new(shortColor, 0))
sellSignal = dir == -1 and dir[1] == 1
plotshape(sellSignal ? shortStop : na, title='Short Stop Start', location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(shortColor, 0))
plotshape(sellSignal and showLabels ? shortStop : na, title='Sell Label', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(shortColor, 0), textcolor=color.new(color.white, 0))

changeCond = dir != dir[1]
alertcondition(changeCond, title='Alert: CE Direction Change', message='Chandelier Exit has changed direction!')
alertcondition(buySignal, title='Alert: CE Buy', message='Chandelier Exit Buy!')
alertcondition(sellSignal, title='Alert: CE Sell', message='Chandelier Exit Sell!')

// Define initial capital
initial_capital =25

// Trigger buy order and close buy order on sell signal
if buySignal
    strategy.entry("Buy", strategy.long, qty = initial_capital / close)

if sellSignal
    strategy.close("Buy")


더 많은