
이 전략은 CCI 지표에 기반한 트렌드 추적 전략이다. 그것은 두 개의 다른 주기의 CCI 지표를 사용하여 거래 신호를 생성한다. 구체적으로, 그것은 더 짧은 주기의 CCI 지표가 더 긴 주기의 CCI 지표를 돌파하는지 여부를 모니터링하고, 돌파의 방향에 따라 더 많이 또는 더 적게 결정한다.
이 전략의 핵심 논리는 다음과 같습니다.
더 많은 것을 할 수 있는 구체적인 규칙은 다음과 같습니다.
이 문서는 다음과 같은 내용을 담고 있습니다.
이 전략은 짧은 기간 CCI의 민감성과 긴 기간 CCI의 안정성을 활용하여 트렌드를 식별하고 추적하는 것을 볼 수 있습니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
위험과 대응하는 방법:
이 전략이 더 개선될 수 있는 부분은 다음과 같습니다.
이 전략은 전체적으로 장기 단기 CCI 지표의 돌파구를 기반으로 한 간단한 트렌드 추적 전략입니다. 그것은 트렌드 방향을 효과적으로 식별하고 트렌드를 추적 할 수 있습니다. 동시에 스톱 로즈와 같은 수단을 통해 위험을 제어합니다. 이 전략은 간단하고 실용적이며, 매개 변수를 조정하는 유연하며, 정량 거래의 입문 전략으로 사용할 수 있습니다.
/*backtest
start: 2023-10-24 00:00:00
end: 2023-11-23 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title="my work",calc_on_order_fills=true,currency=currency.USD, default_qty_type=strategy.percent_of_equity,commission_type=strategy.commission.percent)
source = close
shortlength=input(14)
longlength=input(56)
aa=input(2)
Ss=input(75)
//Cci part
ci1=cci(source,shortlength) //4시간봉의 기본 cci
ci2=cci(source,longlength) //4시간봉에서 12시봉의 cci 무빙측정
//오린간 선생님의 WT + ichimoku
len = input(10)
lenTurn = input(9)
lenStd = input(26)
wtm_e(so, l) =>
esa = ema(so, l)
d = ema(abs(so - esa), l)
ci = (so - esa) / (0.015 * d)
ema(ci, l*2+1)
alh(len) => avg(lowest(len), highest(len))
alh_src(src, len) => avg(lowest(src, len), highest(src, len))
wt = wtm_e(close,len)
turn = alh_src(wt, lenTurn)
std = alh_src(wt, lenStd)
cnt = 0
if wt > turn
cnt:=cnt+1
if wt > std
cnt:=cnt+1
//100,-100선
h0 = hline(100)
h1 = hline(-100)
//plot(ci,color=green)
// plot(k,color=green)
// plot(d,color=red)
plot(ci1,color=green)
plot(ci2,color=red)
plot(0,color=black)
plot(100,color=black)
plot(-100,color=black)
fill(h0,h1,color=purple,transp=95)
bgcolor(cnt==0 ? red : cnt==1 ? blue : cnt == 2 ? green : na, transp = Ss)
//기간조정
Fromday = input(defval=1, title="from day", minval=1, maxval=31)
FromMonth = input(defval=1, title="from month", minval=1, maxval=12)
FromYr = input(defval=2019, title="from yr", minval=1970)
Today = input(defval=13, title="to day", minval=1, maxval=31)
ToMonth = input(defval=12, title="to month", minval=1, maxval=12)
ToYr = input(defval=2019, title="to yr", minval=1970)
startDate = timestamp(FromYr, FromMonth, Fromday, 00, 00)
finishDate = timestamp(ToYr, ToMonth, Today, 00, 00)
Time_cond = true
/////롱
if crossover(ci1,ci2) and change(ci2)>0 and Time_cond
strategy.entry("go", strategy.long, comment="go")
strategy.close("go", (ci2<0 and ci1 <-50 and change(ci1)<0) or (crossunder(ci1,-100) and strategy.openprofit<0) and change(cnt)<0)
/////숏
if (crossunder(ci1,ci2) and change(ci2)<0 and falling(ci1,aa)) and Time_cond
strategy.entry("die", strategy.short, comment="die")
strategy.close("die", (ci2>0 and ci1 > 100 and change(ci1)>0) or (crossover(ci2,100) and strategy.openprofit<0) and change(cnt)>0)