Пользовательские и от сообщества MomentumNot built inZero line Доступно в Builder

ROC

The percentage change from N bars ago — and one of the few indicators where the formula itself is contested. The textbook divides by the old price and is exactly Momentum minus 100; the ROC that ships with MetaTrader divides by the current price and is not. The two always cross zero on the same bar and disagree about every threshold.

Default
14
Centre
0 (Momentum's 100)
Bundled vs textbook
100x / (100 + x)
Bars where ROC is above zerozero — both cross it on the same barROC(14) divided by the old close against the current one

Иллюстративно — синтетические данные, не реальная котировка.

What ROC tells you

ROC is the percentage change over a fixed number of bars. It is the simplest possible momentum measure and it has no smoothing, no recursion and no memory beyond its window — two prices decide the value. What makes it worth a page of its own is that the formula is not settled. The textbook divides the change by the price N bars ago; the ROC.mq5 that ships inside MetaTrader divides it by the current price. Both are called ROC, both are plotted around zero, and they are not the same function. The textbook version turns out to be exactly Momentum minus 100 — measured, they agree to 2.8e-14 over 58,000 bars, which is floating-point rounding and nothing else — so if your terminal has iMomentum it already has that ROC. The bundled version does not reduce to Momentum at all: it is bounded above at +100 while the textbook one is unbounded above, and their asymmetries run in opposite directions. The one thing they always agree on is the sign.

  • MetaTrader has no iROC, but it does ship a ROC.mq5 — and that one divides by the current price
  • The textbook form is Momentum minus 100, exactly
  • Zero crossings are identical between the two; thresholds are not
  1. 1 Take the price now and the price N bars ago
  2. 2 Divide the difference by one of them — this is the choice
  3. 3 Multiply by 100; zero means no net change either way
Показать формулу и детали расчёта

MetaTrader has no iROC, but it does ship a ROC.mq5 under Indicators/Examples — and that file does not use the formula most descriptions do.

bundled (ROC.mq5) : (price[i] - price[i-N]) / price[i]   * 100     <- divides by the current price
textbook          : (price[i] - price[i-N]) / price[i-N] * 100     <- divides by the old price
Momentum.mq5      :  price[i] * 100 / price[i-N]

The third line settles the second: (p - p₀)/p₀ * 100 = p*100/p₀ - 100, so the textbook ROC is exactly Momentum minus 100. Measured over 58,000 bars across four volatility regimes, the largest disagreement was 2.8e-14 — floating-point rounding and nothing more.

The bundled form does not reduce that way. Writing x for the textbook reading:

bundled = 100 * (1 - p₀/p) = 100x / (100 + x)

Comparing that closed form against the computed series, the largest deviation was 1.4e-14. Unlike the ATR case on the Keltner page, the prediction here is exact — there is no residue to explain.

What the transformation does is bend the scale, and the two forms bend in opposite directions:

price moves to r×      textbook      bundled     Momentum
        0.5              -50.00      -100.00        50.00
        0.9              -10.00       -11.11        90.00
        1.0                0.00         0.00       100.00
        1.1               10.00         9.09       110.00
        2.0              100.00        50.00       200.00
        5.0              400.00        80.00       500.00
      100.0             9900.00        99.00     10000.00

The textbook form is unbounded above and floors at −100; the bundled one is capped at +100 and is unbounded below. Neither is symmetric, and they lean opposite ways — at a doubling and a halving, the textbook gives +100 / −50 and the bundled gives +50 / −100.

But both denominators are prices, so both are positive, and the sign of the result is the sign of p − p₀ either way. Measured:

                sign agreement    zero crossings (up)    on the same bar
fx-quiet            100.00%          938 / 938                938
fx-busy             100.00%          823 / 823                823
index               100.00%          896 / 896                896
crypto              100.00%          861 / 861                861

Every zero crossing lands on the same bar. That is why the template trades the zero line: it is the part of this indicator that survives the disagreement about its own formula. Thresholds do not — the mean relative gap between the two forms ran 0.06% on quiet FX, 2.33% on an index and 7.55% on a crypto-like series, and on that last one the count of bars above +10 was 1917 against 2252.

It is worth knowing that the bundled sources are not uniformly unfaithful. The Ultimate Oscillator that ships in the same folder also rewrites its textbook formula — it divides by iATR(N) where the textbook sums true range — and there the rewrite is exact, agreeing to 6.1e-13, because iATR happens to be a plain N-bar mean so the N cancels. Two files, the same folder, the same kind of liberty taken with the formula, and opposite outcomes. Reading the source is what tells them apart.

One last contrast worth drawing with the smoothed indicators. Recomputing ROC from a truncated history: at N bars there is no value, and at N+1 bars the difference from a full-history baseline is exactly zero. There is no recursion for a short history to get wrong.

Сигналы

Отдельные сигналы, поддающиеся бэктестингу, которые даёт ROC — и режим рынка, подходящий для каждого.

Zero Cross

Готово в Builder
Условие
ROC crosses from below zero to above (mirrored for shorts)
Лучший режим
Trending
Типичное применение
The template's entry — and the one signal that survives the choice of denominator

Threshold Break

Готово в Builder
Условие
ROC rises above a fixed percentage
Лучший режим
Trending
Типичное применение
Common and not portable: the same number means different things on the two forms

Divergence

Ручная интерпретация
Условие
Price makes a new high while ROC does not
Лучший режим
Ranging
Типичное применение
Reads the same on both forms as long as the comparison is between ROC values, not against a level

ROC against its own average

Ручная интерпретация
Условие
ROC crosses a moving average of itself
Лучший режим
Either regime
Типичное применение
A way to smooth an unsmoothed indicator without changing the period

Реализация в MT5

Что MetaTrader 5 действительно вычисляет и рисует — основа для каждого правила на этой странице.

Особенности платформы

Работает лучше всего / использовать осторожно

Ни один индикатор не имеет универсального преимущества. Вот где ROC помогает — и где вводит в заблуждение.

Работает лучше всего

  • Zero-cross rules, which mean the same thing under either denominator
  • Comparisons between ROC values — divergences, ranks, relative strength across symbols
  • Short windows, where the two forms are close enough that the choice barely matters
  • Anywhere the readings are re-measured rather than borrowed from a book

Использовать осторожно

  • Fixed thresholds ported between platforms without checking which denominator was used
  • Volatile instruments, where the two forms diverged by 7.55% on average in measurement
  • Treating it as bounded — one form has a ceiling and the other has a floor, on opposite sides
  • Assuming symmetric readings: a doubling and a halving do not produce mirrored numbers on either form

Создать стратегию ROC

Подключите сигнал к правилам входа и выхода, затем экспортируйте компилируемый EA MT5 — без кода.

  1. One ROC node at 14, reading the last closed bar with the textbook denominator
  2. A constant of 0 for it to be crossed against, once upward and once downward
  3. A 50-period EMA compared against the Bid, feeding both directions
  4. Cross up while price is above the average → Close short, then Open Buy · SL 50 / TP 150
  5. Cross down while price is below it → Close long, then Open Sell, mirrored

Совместить ROC с другими индикаторами

Один индикатор редко работает в одиночку. Эти сочетания покрывают слепые пятна ROC.

ROC + Momentum

  1. ROC
  2. Compare
Зачем
Not a pairing but an identity, and the reason to read the two pages together. Momentum in MetaTrader is `price[i] * 100 / price[i-N]`, and the textbook ROC is `(price[i] - price[i-N]) / price[i-N] * 100`. Subtract 100 from the first and you have the second — measured across 58,000 bars on four different volatility regimes, the largest disagreement was 2.8e-14. So a Momentum node crossing 100 and a ROC node crossing zero are the same event, and running both is running one indicator twice. The reason to prefer ROC is that zero is easier to read than 100 and the numbers are directly comparable across instruments
Лучший режим
Either regime

No template holds both, and there is no reason to. Pick whichever centre you would rather compare against.

Открыть Builder →

ROC + Moving Average

  1. ROC
  2. Moving average
  3. And gate
Зачем
ROC has no smoothing at all, which makes it fast and noisy in equal measure — every bar can flip the sign if the price N bars ago happens to be nearby. The template pairs it with a 50-period average of price, not of ROC, so the filter answers a different question than the signal does. The alternative, averaging ROC itself, smooths the signal but delays the crossing; the version here leaves the crossing where it is and refuses the ones pointing against the longer trend
Лучший режим
Trending

This is the shipped template — a ROC node, a 50-period average and a Compare against price.

Открыть Builder →

ROC + RSI

  1. ROC
  2. RSI
  3. And gate
Зачем
Both answer 'how fast', and they disagree usefully. RSI is bounded to 0–100 by construction and saturates: once it is at 85 a further surge barely moves it. ROC is unbounded on one side and keeps growing, so it separates a strong move from an extreme one, which RSI cannot. Reading them together is a way to tell a market that is stretched from one that is simply moving quickly
Лучший режим
Either regime

Add an RSI node beside the ROC node and gate on both.

Открыть Builder →

Параметры

Начальные значения для проверки на вашей паре и таймфрейме — не гарантированные настройки.

Параметр По умолчанию Рекомендуемый диапазон тестирования Что делает
Period 14 1–999 How many bars back the comparison reaches. There is no smoothing to trade off against, so this single number decides everything: a short period is a fast, noisy reading and a long one measures a trend rather than a move. Note that the value depends only on two bars — the one now and the one N back — so an outlier N bars ago keeps distorting the reading until it leaves the window, then drops out all at once.
Denominator the price N bars ago (textbook) previous / current The formula itself. `previous` divides by the old price and is exactly Momentum minus 100. `current` divides by the price now and reproduces the ROC.mq5 that ships with MetaTrader. Measured, they agree on the sign 100% of the time and on nothing else: relative differences averaged 0.06% on quiet FX, 2.33% on an index and 7.55% on a crypto-like series. This is fixed when the EA is generated rather than exposed as an input, because switching it at runtime would silently change what the strategy is.
Applied price Close Close / Open / High / Low / Median / Typical / Weighted Which price the two samples are taken from. The node reads the series directly rather than creating an indicator handle, so median, typical and weighted are assembled from the high, low and close when the EA is generated — there is no cost to choosing one over another.
Shift 1 0–100 Which bar the reading is taken from. The template uses 1 so the crossing is judged on a closed bar. With shift 0 the value moves with every tick, and because there is no smoothing at all, a zero crossing can appear and vanish several times inside one bar.
Timeframe Current Current / M1–MN1 Which series is sampled. Warm-up is trivial here and worth contrasting with the smoothed indicators: measured, the value is exact as soon as N+1 bars exist, because there is no recursion for a truncated history to get wrong. ATR needs hundreds of bars for the same guarantee.

Начальные пресеты

Template 14, textbook denominator, 50-period filter Zero crossings with a longer-term direction filter
Momentum-equivalent Any period, textbook denominator Identical to a Momentum node at the same period, shifted by 100
MetaTrader-bundled Any period, current-price denominator Matches the ROC.mq5 under Indicators/Examples, if you are reproducing its chart

Примеры на рынке

Где ROC работает, где не работает и как фильтр меняет результат.

Работает

The zero cross with the trend behind it

ROC turns up through zero while price is already above the 50-period average. The filter is what separates this from the crossing a few bars earlier, which had the same shape and no direction.

Не работает

The crossing in a flat market

ROC oscillates across zero several times in a row. With no smoothing in the formula, a price that is merely near its level from N bars ago will produce exactly this — which is the case the moving-average filter exists to refuse.

Отфильтровано

The reading that depends on the formula

A sharp move where the two denominators separate visibly. Measured on a volatile series the two forms differ by 7.55% on average here, and a fixed threshold catches a different number of bars on each.

FAQ

Is ROC built into MetaTrader 5?
There is no iROC function, so an EA cannot create a handle to it directly. But the terminal does ship `ROC.mq5` under `Indicators/Examples`, so it appears in the Navigator and can be reached with iCustom. The Builder's node computes the value from the price series instead, which needs no external file.
What is the difference between ROC and Momentum?
Exactly 100, if you use the textbook denominator. Momentum in MQL5 is `price * 100 / price[N]` and the textbook ROC is `(price - price[N]) / price[N] * 100`, which is the same expression minus 100. Measured over 58,000 bars the largest difference was 2.8e-14. The bundled ROC.mq5 is a different matter — it divides by the current price and does not reduce to Momentum.
Which denominator should I use?
Whichever your numbers were measured on. Use the textbook form if your thresholds came from a book, a chart on another platform, or anything comparing to Momentum. Use the current-price form if you are reproducing the chart MetaTrader itself draws. What you should not do is tune on one and run the other — measured, the count of bars above +10 on a volatile series changed by a factor of 0.851.
Do the two forms give different signals?
Only for thresholds. The sign is identical because both denominators are positive — measured, 100.00% sign agreement and every zero crossing on the same bar, 938 out of 938 on one series. So a zero-cross rule is unaffected and a threshold rule is affected in proportion to how large the moves are.
Is ROC bounded?
It depends which one, and the answer is opposite for each. The textbook form is unbounded above and cannot go below -100 (price cannot fall more than 100%). The bundled form is capped at +100 and unbounded below. At a five-fold rise they read 400 and 80 respectively.
What period should I use?
14 is a common default and the template's. Since there is no smoothing, the period is the only thing controlling how noisy the line is — shorter reacts to individual bars, longer describes a trend. Worth knowing: the value depends on exactly two bars, so an outlier N bars ago distorts the reading until it leaves the window and then disappears from it all at once.
How much history does ROC need?
N+1 bars, and then it is exact. Measured against a full-history baseline, there is no value at N bars and a difference of exactly zero at N+1. There is no recursion for a truncated history to get wrong — unlike ATR, which measurably needed hundreds of bars to converge.
Can I smooth it?
Yes, by comparing ROC against a moving average of itself, which is a common variant. The template takes a different route and filters with an average of price rather than of ROC, so the crossing stays where it is and the filter answers a separate question. Averaging ROC itself delays the crossing, which is the trade-off.
Can I build this without coding?
Yes. The template is one ROC node at period 14 on the closed bar, a constant of zero for it to cross, two Cross nodes for the two directions, a 50-period EMA with two Compare nodes against the Bid, two And gates, two Close nodes wired ahead of the entries, and Open Buy / Open Sell on a fixed lot. The period and the filter length are set in the Builder; the compiled EA exposes the period, stop distances, lot size and maximum spread as inputs.

Glossary

Ключевые термины