
역동량 인덱스 (Relative Momentum Index, RMI) 전략은 역동량 인덱스를 기반으로 한 개선 전략이다. 이 전략은 일정 기간 동안 가격 변화의 역량을 계산하여 시장이 과매매 또는 과매매 상태에 있는지 판단하여 역동 기회를 잡는다.
RMI 전략의 계산 공식은 다음과 같습니다:
xMom = xPrice - xPrice[Length] //计算Length周期内的价格变动
xMU = 如果xMom >= 0:之前xMU减去xMU/Length加上xMom;否则:之前xMU
xMD = 如果xMom <= 0:之前xMD减去xMD/Length加上xMom的绝对值;否则:0
RM = xMU / xMD
RMI = 100 * (RM / (1 + RM))
이 전략은 먼저 Length 주기의 가격 변화를 xMom로 계산한다. xMom> = 0이면 가격이 상승하면, xMU는 xMom을 더한다. xMom < 0이면 가격이 떨어지면, xMD는 xMom의 절대값을 더한다.
RMI가 저가치 SellZone보다 높을 때, 과매입을 의미하며, 상장한다. RMI가 저가치 BuyZone보다 낮을 때, 과매매를 의미하며, 더 많이 한다.
적절히 느슨한 스톱포인트, 최적화된 변수 조합, 트렌드 전략 조합 등의 방법으로 위험을 줄일 수 있다.
RMI 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
RMI 전략은 가격 동력의 변화를 측정하여 반전 작업을 수행하여 짧은 선 회귀 기회를 효과적으로 포착 할 수 있습니다. RMI 전략은 RSI 전략에 비해 더 민감하고 충격에 영향을받지 않습니다. 그러나이 전략은 여전히 조정이 될 위험이 있으며, 변수를 최적화하고 트렌드 전략과 함께 사용해야 최대 효과를 얻을 수 있습니다.
/*backtest
start: 2023-10-02 00:00:00
end: 2023-10-21 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 19/10/2017
// The Relative Momentum Index (RMI) was developed by Roger Altman. Impressed
// with the Relative Strength Index's sensitivity to the number of look-back
// periods, yet frustrated with it's inconsistent oscillation between defined
// overbought and oversold levels, Mr. Altman added a momentum component to the RSI.
// As mentioned, the RMI is a variation of the RSI indicator. Instead of counting
// up and down days from close to close as the RSI does, the RMI counts up and down
// days from the close relative to the close x-days ago where x is not necessarily
// 1 as required by the RSI). So as the name of the indicator reflects, "momentum" is
// substituted for "strength".
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Relative Momentum Index", shorttitle="RMI")
xPrice = close
Length = input(20, minval=1)
BuyZone = input(40, minval=1)
SellZone = input(70, minval=1)
reverse = input(false, title="Trade reverse")
// hline(0, color=gray, linestyle=dashed)
// hline(SellZone, color=red, linestyle=line)
// hline(BuyZone, color=green, linestyle=line)
xMom = xPrice - xPrice[Length]
xMU = iff(xMom >= 0, nz(xMU[1], 1) - (nz(xMU[1],1) / Length) + xMom, nz(xMU[1], 1))
xMD = iff(xMom <= 0, nz(xMD[1], 1) - (nz(xMD[1],1) / Length) + abs(xMom), nz(xMD[1], 0))
RM = xMU / xMD
nRes = 100 * (RM / (1+RM))
pos = iff(nRes < BuyZone, 1,
iff(nRes > SellZone, -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(nRes, color=blue, title="RMI")