Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 04:18:55 +0000



Post From: RMI - Relative Momentum Index

[2013-12-11 16:54:58]
ganz - Posts: 1048
Ronin

this is how SC's RMI works:

indi starts in ASC_Source/studies7.cpp/line_5045

>> get starting point: max of RMI Length or RMI MA Length you've chosen

sc.DataStartIndex = max(RMILength.GetInt(), RMI_MALength.GetInt());

>> get values to calculate Momentum

float previousValue = sc.BaseDataIn[InputData.GetInputDataIndex()][sc.Index - RMILength.GetInt()];
float currentValue = sc.BaseDataIn[InputData.GetInputDataIndex()][sc.Index];

>> build +/- Momentum Arrays

if (currentValue > previousValue)
  {
    UpTempArray[sc.Index] = currentValue - previousValue;
    DownTempArray[sc.Index] = 0.0f;
  }
  else
  {
    UpTempArray[sc.Index] = 0;
    DownTempArray[sc.Index] = previousValue - currentValue;
  }

>> get MA values for +/- Momentum Arrays

sc.MovingAverage(UpTempArray, SmoothedUpTempArray, RMI_MAType.GetMovAvgType(), RMI_MALength.GetInt());
sc.MovingAverage(DownTempArray, SmoothedDownTempArray, RMI_MAType.GetMovAvgType(), RMI_MALength.GetInt());

>> calculate RMI as 100 * SmoothedUp / ( SmoothedUp + SmoothedDown )

if (SmoothedUpTempArray[sc.Index] + SmoothedDownTempArray[sc.Index] != 0.0f)
  {
    RMI[sc.Index] = 100 * SmoothedUpTempArray[sc.Index] / (SmoothedUpTempArray[sc.Index] + SmoothedDownTempArray[sc.Index]);
  }
  else
  {
    RMI[sc.Index] = RMI[sc.Index - 1];
  }

I'm not able to dig it down so I've no idea what's wrong w it /cause i dislike to use any MA based indi/

If you need to correct the formula pls let me know
Date Time Of Last Edit: 2013-12-11 17:00:09