Skip to main content
BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——
Precios

Momentum

Close minus the close N bars ago — the simplest momentum measure. TradeStation, MetaStock and MT5 code.

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.

EasyLanguage
inputs: Length(10);
variables: MyMom(0);
MyMom = Momentum(Close, Length);
Plot1(MyMom, "Momentum");
MetaStock
{Momentum - period 10}
momVal := MOM(C, 10);
momVal
MQL5 · Momentum.mq5
#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.