
이 전략의 핵심 아이디어는 카마 평균선 지표와 평균선 지표를 결합하여 시장 추세를 식별하여 트렌드 추적을 구현하는 것입니다. 카마 평균선과 평균선이 금색으로 교차 할 때 상승 추세로 판단하여 더 많은 것을하십시오. 카마 평균선과 평균선이 사망 추세로 교차 할 때 하향 추세로 판단하여 공백을하십시오.
이 전략의 전반적인 생각은 명확하며, 카마 평균선과 평균선 지표의 황금 횡단과 죽음의 횡단으로 트렌드를 판단하고 추적하고, 회수 제어 능력이 강하며, 매개 변수를 조정하고 최적화함으로써 더 나은 효과를 얻을 수 있다. 그러나 더 많은 검증 지표와 손해 막기 모듈을 추가하면 전략의 안정성과 수익력을 더욱 강화할 수 있는 개선의 여지가 있다.
/*backtest
start: 2024-01-29 00:00:00
end: 2024-02-05 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
//synapticex.com
kamaPeriod = input(8, minval=1)
ROCLength=input(4, minval=1)
kama(length)=>
volatility = sum(abs(close-close[1]), length)
change = abs(close-close[length-1])
er = iff(volatility != 0, change/volatility, 0)
sc = pow((er*(0.666666-0.064516))+0.064516, 2)
k = nz(k[1])+(sc*(hl2-nz(k[1])))
n=input(title="period",defval=7)
n2ma=2*wma(close,round(n/2))
nma=wma(close,n)
diff=n2ma-nma
sqn=round(sqrt(n))
n2ma1=2*wma(close[1],round(n/2))
nma1=wma(close[1],n)
diff1=n2ma1-nma1
sqn1=round(sqrt(n))
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
c=n1>n2?lime:red
ma=plot(n1,color=c, linewidth = 3)
plot(cross(nma, nma1) ? nma : na, style = cross, color = c, linewidth = 5)
kamaEntry = request.security(syminfo.tickerid,timeframe.period,kama(kamaPeriod))
plot(kamaEntry, color=gray, title="Kama",transp=0, trackprice=false, style=line)
strategy("Kama VS HeikinAshi", overlay=true, pyramiding=0, calc_on_every_tick=true, calc_on_order_fills=true)
buyEntry = n1 > n2
sellEntry = close < kamaEntry and n1 < n2
buyExit = close < kamaEntry and n1 < n2
sellExit = n1 > n2
if (buyEntry)
strategy.entry("KAMAL", strategy.long, comment="KAMAL")
else
strategy.close("KAMAL", when=buyExit)
if (sellEntry)
strategy.entry("KAMAS", strategy.short, comment="KAMAS")
else
strategy.close("KAMAS", when = sellExit)