
헤이킨 아시와 카우프만 자율적 이동 평균 거래 전략 (HLC3/Kaufman Strategy) 은 헤이킨 아시 K 라인과 카우프만 자율적 이동 평균 (KAMA) 을 결합한 양적 거래 전략이다. 이 전략은 헤이킨 아시 K 라인을 통해 거래 방향을 결정하고, 카우프만 자율적 이동 평균을 보조 지표로 사용하여 거래 신호 필터링한다.
이 전략은 다음과 같은 주요 부분들로 구성됩니다.
헤이킨 아시 (Heikin Ashi) 개시 가격과 종료 가격을 계산한다. 이 가격은 K선 엔티티의 중간 가격을 반영하여 일부 잡음을 필터링 할 수 있다.
카우프만의 자기 적응 이동 평균을 계산하는 방법 (KAMA) . KAMA는 시장의 급격한 급격한 변동이 있을 때 너무 많은 지연을 일으키지 않고 자신의 부드러움을 동적으로 조정할 수 있다.
헤이킨 아쉬 종전 가격과 KAMA의 크기와의 관계를 비교하여 구매 및 판매 신호를 결정한다. 헤이킨 아쉬 종전 가격 위에 KAMA를 통과할 때 구매 신호가 발생하고, 헤이킨 아쉬 종전 가격 아래에 KAMA를 통과할 때 판매 신호가 발생한다.
ADX 지표를 추가하여 트렌드 강도를 판단하여 흔들리는 시장에서 잘못된 신호를 방지 할 수 있습니다.
이 전략의 가장 큰 장점은 Heikin Ashi K 와 KAMA의 듀얼 필터링을 결합하여 노이즈 트랜잭션과 잘못된 신호를 크게 줄일 수 있다는 것입니다. 구체적인 장점은 다음과 같습니다:
헤이킨 아시와 카우프만 자율 적응 이동 평균 거래 전략은 쌍방향 파동의 트렌드 추적 전략이다. 그것은 헤이킨 아시 K 선의 무음 기능과 KAMA의 트렌드 변화에 대한 빠른 추적의 장점을 결합하여, 잡음 거래를 효과적으로 필터링하고, 잘못된 신호를 줄여, 중장기 트렌드를 추적하는 데 적합하다. 이 전략은 파라미터 최적화, 보조 지표 확인 등의 수단으로 안정성과 수익성을 더욱 향상시킬 수 있다.
/*backtest
start: 2022-12-12 00:00:00
end: 2023-12-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
//Heikin/Kaufman by Marco
strategy("HLC3/Kaufman Strategy ",shorttitle="HLC3/KAU",overlay=true)
res1 = input(title="Hlc3 Time Frame", defval="D")
test = input(1,"Hlc3 Shift")
sloma = input(20,"Slow EMA Period")
//Kaufman MA
Length = input(5, minval=1)
xPrice = input(hlc3)
xvnoise = abs(xPrice - xPrice[1])
Fastend = input(2.5,step=.5)
Slowend = input(20)
nfastend = 2/(Fastend + 1)
nslowend = 2/(Slowend + 1)
nsignal = abs(xPrice - xPrice[Length])
nnoise = sum(xvnoise, Length)
nefratio = iff(nnoise != 0, nsignal / nnoise, 0)
nsmooth = pow(nefratio * (nfastend - nslowend) + nslowend, 2)
nAMA = nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1]))
//Heikin Ashi Open/Close Price
//ha_t = heikinashi(tickerid)
//ha_close = request.security(ha_t, period, nAMA)
//mha_close = request.security(ha_t, res1, hlc3)
bha_close = request.security(syminfo.ticker, timeframe.period, nAMA)
bmha_close = request.security(syminfo.ticker, res1, hlc3)
//Moving Average
//fma = ema(mha_close[test],1)
//sma = ema(ha_close,sloma)
//plot(fma,title="MA",color=black,linewidth=2,style=line)
//plot(sma,title="SMA",color=red,linewidth=2,style=line)
bfma = ema(bmha_close[test],1)
bsma = ema(bha_close,sloma)
plot(bfma,title="MA",color=black,linewidth=2,style=line)
plot(bsma,title="SMA",color=red,linewidth=2,style=line)
//Strategy
//golong = crossover(fma,sma)
//goshort = crossunder(fma,sma)
golong = crossover(bfma,bsma)
goshort = crossunder(bfma,bsma)
strategy.entry("Buy",strategy.long,when = golong)
strategy.entry("Sell",strategy.short,when = goshort)