The simplest momentum measure: the current close minus the close N bars ago. Positive and rising values show accelerating upside; the zero line separates bullish from bearish momentum, and divergence from price warns of a fading trend. Copy the version for your platform.
inputs: Length(10);
variables: MyMom(0);
MyMom = Momentum(Close, Length);
Plot1(MyMom, "Momentum");{Momentum - period 10}
momVal := MOM(C, 10);
momVal#property indicator_separate_window
#property indicator_buffers 1
input int Mom_Period = 14;
double MomBuffer[];
int OnInit() {
SetIndexBuffer(0, MomBuffer);
IndicatorSetString(INDICATOR_SHORTNAME, "Momentum(" + IntegerToString(Mom_Period) + ")");
return INIT_SUCCEEDED;
}
int OnCalculate(const int rates_total, const int prev_calculated,
const datetime &time[], const double &open[], const double &high[],
const double &low[], const double &close[], const long &tick_volume[],
const long &volume[], const int &spread[]) {
for (int i = prev_calculated; i < rates_total; i++)
MomBuffer[i] = iMomentum(NULL, 0, Mom_Period, PRICE_CLOSE, i);
return rates_total;
}To use it inside dtcharts, paste any version into the Script Converter and it becomes a native indicator on your chart.