
이 전략은 CK 통로를 사용하여 가격 추세를 판단하고 동적 스톱로스 라인을 설정하여 가격 반전이 발생하면 역으로 작동하며, 짧은 라인 거래 전략에 속한다.
전략은 CK 채널을 사용하여 가격 추세와 지지 저항을 판단한다. 상위 채널 라인과 하위 채널 라인을 계산하고, 가격이 채널 라인을 돌파 할 때 거래 신호를 발생시킨다. 또한, 전략은 채널 라인의 움직임을 추적하고, 채널 라인이 역전될 때 역전 포지션을 취하며, 역전 거래 전략에 속한다.
구체적으로, 전략은 최고 가격, 최저 가격에 기초하여 상하 통로선을 계산한다. 상하 통로선이 하락하기 시작하면, 하하 통로선이 상승하기 시작하면, 가격 반전으로 판단하여, 공백을 한다. 반대로, 하하 통로선이 하락하기 시작하면, 상하 통로선이 상승하기 시작하면, 가격 반전으로 판단하여, 다중을 한다.
이 전략의 전체적인 아이디어는 명확하고 이해하기 쉽다. 이중 채널을 사용하여 가격 역전을 판단하고 역전 작업을 수행한다. 그리고 동적 스톱로스를 설정하여 위험을 제어하는 것은 전형적인 단선 거래 전략에 속한다. 전략 효과는 주로 스톱로스 매개 변수를 조정하고 다른 기술 지표를 보조하여 동작 시기를 판단 할 수 있습니다.
/*backtest
start: 2023-10-27 00:00:00
end: 2023-11-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//
//study(title="Chande Kroll Stop", shorttitle="CK Stop", overlay=true)
strategy(title="Chande Kroll Stop", shorttitle="Chande Kroll Stop回測", overlay=true, initial_capital=100000, calc_on_every_tick=true,default_qty_type=strategy.percent_of_equity, default_qty_value=10)
br_red = #e91e63,Red = #f41818,n_green = #91dc16,dk_green = #004d40,lt_green = #16dc78,lt_blue = #0dbdd8,dk_blue = #0a3577,Blue = #034fed,br_orange = #f57c00,dk_orange = #e65100,dk_gray = #434651,dk_pink = #7c1df0,lt_pink = #e743f5,Purple = #5b32f3,lt_purple = #6b5797
hiP = input(9, "",inline="h")
hix = input(1,"" ,inline="h", step=0.1)
hiQ = input(7,"" ,inline="h")
loP = input(9,"" ,inline="h1")
lox = input(1,"" ,inline="h1", step=0.1)
loQ = input(5,"" ,inline="h1")
Xr=input(false,"反向操作:買/賣",inline="T"),
first_high_stop = highest(high, hiP) - hix * atr(hiP)
first_low_stop = lowest(high, loP) + lox * atr(loP)
stop_short = highest(first_high_stop, hiQ)
stop_long = lowest(first_low_stop, loQ)
cklow = stop_short
ckhigh = stop_long
Xdn = cklow < cklow[1] and ckhigh < ckhigh[1]
Xup = cklow > cklow[1] and ckhigh > ckhigh[1]
longcol = Xup ? lt_green : Xdn ? br_red : #2a2e39
shortcol = Xup? lt_green : Xdn ? br_red : #2a2e39
plot(stop_long, color=longcol)
plot(stop_short, color=shortcol)
plotshape(Xup and not Xup[1] , title="CK Stop Buy", text='CK', style=shape.triangleup, size=size.tiny, location=location.belowbar, color=lt_green, textcolor=lt_green,display=display.none)
plotshape(Xdn and not Xdn[1], title="CK Stop Sell", text='CK', style=shape.triangledown, size=size.tiny, location=location.abovebar, color=br_red, textcolor=br_red,display=display.none)
// , default_qty_type=strategy.percent_of_equity, default_qty_value=10, calc_on_every_tick=true)
tl=input(true,"Sig",inline="T"), sbg=input(true,"Bgtrend",inline="T"), vbuild="FIREHORSE XRPUSDT"
Xp = 0.0, Xp:=Xdn? -1 : Xup? 1 : Xp[1], Xdf = Xr? Xup and Xp[1] == -1 : Xdn and Xp[1] == 1 ,Xuf = Xr? Xdn and Xp[1] == 1: Xup and Xp[1] == -1
FY=input(2021,"年",inline="btf"),FM=input(9,"月",inline="btf"),FD=input(01,"日",inline="btf"),
TY = input(2032,"年",inline="to"),TM=input(01,"月",inline="to"),TDy=input(01,"日",inline="to"),
testTF = time>=timestamp(FY,FM,FD,00,00) and time <= timestamp(TY,TM,TDy,23,59)? true:false
plotchar(tl? Xuf:na,vbuild+" 生門","△",location.bottom, #14e540,10,0," " ,#14e540,1,size.tiny)// ︽ ︾
plotchar(tl? Xdf:na,vbuild+" 傷門","▽",location.top, #9b0842,10,0," ", #9b0842,1,size.tiny)
bgcolor(sbg ? Xp==1 ? #0d47a1 :na: na, transp=90),
alertcondition(Xuf,vbuild+ "Buy", "Long 💹 \n"+vbuild), alertcondition(Xdf, vbuild+ " Sell","Short 🈹\n"+vbuild)
if Xuf
alert("Long " + tostring(close)+"\nLong "+input("My Long Msg","Long Alert Msg")+vbuild, alert.freq_once_per_bar)
if Xdf
alert("Short " + tostring(close)+"\nShort"+input("My Short Msg","Short Alert Msg")+vbuild, alert.freq_once_per_bar)
if testTF
strategy.entry("Long ", strategy.long, comment=" Long ",when=Xuf), strategy.entry("Short", strategy.short, comment=" Short",when=Xdf )