밴드 채널을 기반으로 한 다중 시간 프레임 거래 전략


생성 날짜: 2023-09-20 15:47:46 마지막으로 수정됨: 2023-09-20 15:47:46
복사: 0 클릭수: 776
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

개요

이 전략은 적응형 파도 통로를 기반으로, 두 가지 다른 추적 중지 손실 전략을 설계하고, 여러 시간 프레임에 대한 체계적인 재검토 검증을 수행하며, 트렌드 추적 유형의 거래 전략에 속한다.

전략 원칙

  1. 자기 적응 파장 통로의 상하 궤도를 계산하고, 통로 폭은 파라미터를 통해 조정한다.

  2. 브레이크 트래킹 전략: 가격이 통로를 뚫고 포지션을 열고, 통로 안에 있을 때 손실을 멈춘다.

  3. 회귀 역전 전략, 가격이 통로에 도달했을 때 포지션을 열고, 가격이 통로로 돌아왔을 때 중지한다.

  4. CCI 지표는 다공선 (多空線) 을 판단하는데 도움을 준다.

  5. 다중 시간 프레임 리테스트는 두 가지 전략의 가능성을 검증합니다.

우위 분석

  1. 파동통로는 간단하고 직관적이며 가격 동향을 효과적으로 포착할 수 있다.

  2. 이 두 가지 전략은 시장의 상황에 맞게 적용되어 안정성을 높일 수 있습니다.

  3. CCI 지표는 공백을 판단하는 데 도움을 줍니다.

  4. 여러 시간 프레임으로 재검토하면 결과가 더욱 설득력 있게 됩니다.

  5. 전략 규칙은 간단하고 명확하며, 실행하기 쉽습니다.

위험 분석

  1. 파도 통로가 작동하지 않을 수 있는 경우

  2. 두 가지 전략 모두 너무 일찍 또는 너무 늦게 중단될 위험이 있습니다.

  3. CCI 지표는 잘못된 신호를 보낼 수 있습니다.

  4. 이 자료의 오차는 신중하게 처리되어야 합니다.

  5. 매개 변수 최적화 시에는 과합이 있을 수 있다.

최적화 방향

  1. 다양한 변수를 테스트하여 최적의 변수 조합을 찾습니다.

  2. 다른 지표를 추가하여 신호 필터링을 평가하십시오.

  3. 손해를 막는 전략을 최적화하고 위험을 줄여라.

  4. 통로 너비에 적응하는 계산 방법을 연구한다.

  5. 더 많은 품종과 주기에서 재검토 및 검증한다.

  6. 기계학습을 이용한 동적 최적화 매개 변수.

요약하다

이 전략은 파도통로를 기반으로 두 가지 추적 중지 전략을 설계하고, 여러 시간 프레임의 재검증 검증을 수행한다. 매개 변수 최적화, 중지 전략 개선 등의 방법으로 시스템의 안정성을 강화하고, 성숙한 신뢰할 수 있는 트렌드 추적 거래 시스템으로 개발할 수 있다.

전략 소스 코드
/*backtest
start: 2022-09-13 00:00:00
end: 2023-09-19 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy(title = "Underworld Hunter", overlay=true)

len = input(75, minval=1, title="Length")
src = input(close, title="Source")
basis = 0.0
basis := na(basis[1]) ? sma(src, len) : ema(ema(ema(src,len),len),len)

mult = input(1.9, minval=0.001, maxval=50, title="Deviation")
dev = mult * stdev(src, len)
upper = basis + dev
lower = basis - dev

//CCI calculation and inputs

lengthcci = input(20, minval=1, title="Period for CCI")
ma = sma(close, lengthcci)
ccivalue = (src - ma) / (0.015 * dev(src, lengthcci))

//CCI plotting

cciover0 = ccivalue >= 100 and ccivalue <= 120
cciover1 = ccivalue > 120 and ccivalue <= 140
cciover2 = ccivalue > 140 and ccivalue <= 160
cciover3 = ccivalue > 160 and ccivalue <= 180
cciover4 = ccivalue > 180

cciunder0 = ccivalue <= -100 and ccivalue >= -120
cciunder1 = ccivalue <= -120 and ccivalue > -140
cciunder2 = ccivalue <= -140 and ccivalue > -160
cciunder3 = ccivalue <= -160 and ccivalue > -180
cciunder4 = ccivalue <= -180

plotshape(cciover0, title="CCIO0", location=location.abovebar, color=#c6ff1a, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciunder0, title="CCIU0", location=location.belowbar, color=#c6ff1a, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciover1, title="CCIO1", location=location.abovebar, color=#ffff00, transp=0,style=shape.circle, size=size.tiny)
plotshape(cciunder1, title="CCIU1", location=location.belowbar, color=#ffff00, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciover2, title="CCIO2", location=location.abovebar, color=#ff9900, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciunder2, title="CCIU2", location=location.belowbar, color=#ff9900, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciover3, title="CCIO3", location=location.abovebar, color=#ff0000, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciunder3, title="CCIU3", location=location.belowbar, color=#ff0000, transp=0, style=shape.circle, size=size.tiny)
plotshape(cciover4, title="CCIO4", location=location.abovebar, color=#cc00cc, transp=0,style=shape.circle, size=size.tiny)
plotshape(cciunder4, title="CCIU4", location=location.belowbar, color=#cc00cc, transp=0,style=shape.circle, size=size.tiny)

//plotting

plot(upper, title="Upper shadow", color=color.black, transp = 30, linewidth = 4)
plot(upper, title="Upper line", color=#FF2E00, transp = 0, linewidth = 2)
plot(lower, title="Lower shadow", color=color.black, transp = 30, linewidth = 4)
plot(lower, title="Lower line", color=#FF2E00, transp = 0, linewidth = 2)
plot(basis, title="Basic line", color=color.red, transp = 50, linewidth = 2)

mean = input(title="Test Reverse to the Mean instead", type=input.bool, defval=false)
test = input(title="Enable testing", type=input.bool, defval=true)

ordersize=floor(50000/close)

if(close>upper and strategy.opentrades==0 and not mean and test)
    strategy.entry("Hunt Up", strategy.long, ordersize)
if (close<upper and close[1]<upper and close[2]<upper)
    strategy.close("Hunt Up", qty_percent = 100, comment = "Hunt End")

if(close<lower and strategy.opentrades==0 and not mean and test)
    strategy.entry("Hunt Down", strategy.short, ordersize)
if (close>lower and close[1]>lower and close[2]>lower)
    strategy.close("Hunt Down", qty_percent = 100, comment = "Hunt End")

//bounce of bands

if(close>upper and strategy.opentrades==0 and mean and test)
    strategy.entry("Sneak Down", strategy.short, ordersize)
if (close<upper and close[1]<upper and close[2]<upper and close>high[1])
    strategy.close("Sneak Down", qty_percent = 100, comment = "SneakEnd")

if(close<lower and strategy.opentrades==0 and mean and test)
    strategy.entry("Sneak Up", strategy.long, ordersize)
if (close>lower and close[1]>lower and close[2]>lower and close<low[1])
    strategy.close("Sneak Up", qty_percent = 100, comment = "Sneak End")