
이 전략은 가격 트렌드를 추적하기 위해 적응된 이동 평균 지표 카우프만 적응된 이동 평균 (KAMA) 을 사용하여 낮은 가격과 높은 가격으로 거래하여 수익을 얻습니다.
카우프만 자기 적응 이동 평균 (KAMA) 지표의 계산 공식은 다음과 같다.
nAMA = nz(nAMA[1]) + nsmooth * (Close - nz(nAMA[1]))
其中:
nsmooth = (nefratio * (nfastend - nslowend) + nslowend)^2
nefratio = nsignal / nnoise
nsignal = |Close - Close[Length]|
nnoise = sum(|Close - Close[1]|, Length)
nfastend = 0.666
nslowend = 0.0645
이 지표는 시장의 변동성과 가격 변화의 추세를 고려하여 가격 추세를 더 빠르게 추적 할 수 있습니다. 구체적으로:
가격과 KAMA의 관계를 비교하여 가격의 추세 방향을 판단하여 더 많은 공백을 결정 할 수 있습니다.
이 전략의 가장 큰 장점은 가격 추세 변화를 추적하는 적응형 이동 평균 지표를 활용하여 잡음의 영향을 효과적으로 줄일 수 있다는 것입니다. 구체적인 장점은 다음과 같습니다:
이 전략에는 몇 가지 위험도 있습니다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
이 전략은 카우프만 자기 적응 이동 평균 지표를 사용하여 가격 트렌드를 추적합니다. 의사 결정 규칙은 간단하고 명확하며, 실내에서 작동하기가 쉽습니다. 이 지표는 소음을 억제하면서 가격 변화에 빠르게 반응하고, 추적 효과가 좋으며, 권장되는 경향 추적 전략입니다.
/*backtest
start: 2023-12-03 00:00:00
end: 2024-01-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 25/08/2017
// Everyone wants a short-term, fast trading trend that works without large
// losses. That combination does not exist. But it is possible to have fast
// trading trends in which one must get in or out of the market quickly, but
// these have the distinct disadvantage of being whipsawed by market noise
// when the market is volatile in a sideways trending market. During these
// periods, the trader is jumping in and out of positions with no profit-making
// trend in sight. In an attempt to overcome the problem of noise and still be
// able to get closer to the actual change of the trend, Kaufman developed an
// indicator that adapts to market movement. This indicator, an adaptive moving
// average (AMA), moves very slowly when markets are moving sideways but moves
// swiftly when the markets also move swiftly, change directions or break out of
// a trading range.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Kaufman Moving Average Adaptive (KAMA)", shorttitle="Kaufman Moving Average Adaptive (KAMA)", overlay = true)
Length = input(21, minval=1)
xPrice = close
xvnoise = abs(xPrice - xPrice[1])
nfastend = 0.666
nslowend = 0.0645
reverse = input(false, title="Trade reverse")
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]))
pos = iff(close[1] > nAMA, 1,
iff(close[1] < nAMA, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(nAMA, color=blue, title="KAMA")