채널 브레이크업 SMA 전략

저자:차오장, 날짜: 2023-10-23 17:08:51
태그:

img

전반적인 설명

이 전략은 채널 브레이크오프를 기반으로 하며 이동 평균 크로스오버를 출구 신호로 사용합니다. 선물과 지표에 잘 작동합니다.

전략 논리

  1. 상위와 하위 채널을 만들기 위해 특정 기간 동안 가장 높은 높고 가장 낮은 낮은 계산.

  2. 가격이 상단 채널을 넘어서면 장거리; 가격이 하단 채널을 넘어서면 단거리.

  3. 빠른 SMA와 느린 SMA를 계산합니다

  4. 길다면, 빠른 SMA가 느린 SMA를 넘을 때 길게 닫습니다. 짧다면, 빠른 SMA가 느린 SMA를 넘을 때 짧게 닫습니다.

이점 분석

  1. 채널과 이동 평균 시스템을 결합하면 수익성이 향상 될 수 있습니다.

  2. 채널은 회전을 판단하고 SMA는 트렌드 고갈을 판단합니다.

  3. SMA 필터는 을 피하고 불필요한 트레이드를 줄입니다.

  4. 조정 가능한 채널 범위는 다른 기간과 변동성에 적합합니다.

위험 분석

  1. 부적절한 채널 범위는 틈을 놓칠 수도 있고 잘못된 틈을 만들 수도 있습니다.

  2. 부적절한 SMA 매개 변수는 일찍 또는 늦게 나올 수 있습니다.

  3. 단일 손실을 제한하기 위해 합리적인 위치 크기가 필요합니다.

  4. 유효한 브레이크아웃을 조심하세요. 높은 가격과 낮은 가격의 판매를 피하세요.

최적화

  1. 채널 범위와 SMA 기간을 최적화하기 위한 테스트 매개 변수

  2. 트렌드 필터를 추가해서 성공률을 높여

  3. 고정 분자와 마틴게일과 같은 포지션 크기를 추가합니다.

  4. 단일 손실을 제어하기 위해 스톱 손실을 추가합니다.

요약

이 전략은 채널과 SMA를 활용하여 강력한 트렌드에서 안정적인 이득을 달성합니다. 그러나 윙사 손실은 피해야하며 위치 사이징은 중요합니다. 매개 변수 조정, 신호 필터링 및 리스크 관리에 대한 추가 개선은 견고성을 향상시킬 것입니다.


/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-13 00:00:00
period: 1m
basePeriod: 1m
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/
// © anshuanshu333

//@version=4

// strategy("ChBrkOutStrategySMA", overlay=true, initial_capital = 200000)
length = input(title="Length", type=input.integer, minval=1, maxval=1000, defval=7)
     
fastSMA = sma(close,9)
slowSMA = sma(close,21)

upBound = highest(high, length)
downBound = lowest(low, length)

boundLongEntry = ((close >= upBound) or (high >= upBound)) and fastSMA>slowSMA and (close > open)
boundShortEntry =((close <= downBound) or (low <= downBound)) and fastSMA<slowSMA and (close <open)

u=plot(upBound, title = "Upper Bound",color=color.blue, linewidth=1)
l=plot(downBound, title = "Lower Bound",color=color.red, linewidth=1)
plot(fastSMA,title = "Fast SMA", color = color.red, linewidth =2)
plot(slowSMA,title = "Slow SMA" ,color = color.green, linewidth =1)
fill(u,l, transp=95)
plot(avg(upBound,downBound), title = "Avg", color=color.gray,linewidth =1)

     
if (boundLongEntry )
    strategy.entry("LE", long = true)
    
if (boundShortEntry)
    strategy.entry("SE", long = false)
    
SmaLongExit = crossunder(fastSMA,slowSMA)
SmaShortExit = crossover(fastSMA,slowSMA)

    
//Close TRades   
if (strategy.position_size > 0)
    strategy.close(id="LE",when= SmaLongExit)
if (strategy.position_size < 0)
    strategy.close(id="SE",when= SmaShortExit)

더 많은