ROC in EasyLanguage — TradeStation & MultiCharts

The RateOfChange function and a zero-cross strategy

ROC in EasyLanguage
ROC in EasyLanguage

The Rate of Change is a two-line EasyLanguage study, whether you use the built-in function or spell out the arithmetic. See the explainer for the concept.

What you’ll need

  • TradeStation or MultiCharts
  • The EasyLanguage / PowerLanguage Editor, new Indicator

The source

{ AlgoGen ROC — TradeStation / MultiCharts }
inputs:
    Length( 12 );

variables:
    ROCval( 0 );

ROCval = RateOfChange( Close, Length );   { percent change over Length bars }

Plot1( ROCval, "ROC" );
Plot2( 0, "Zero" );

if ROCval >= 0 then
    SetPlotColor( 1, Green )
else
    SetPlotColor( 1, Red );

RateOfChange( Close, Length ) returns the percentage change over Length bars — the zero-centered oscillator from the output chart. Colouring by sign makes the momentum regime obvious. (You can also write it by hand: 100 * (Close - Close[Length]) / Close[Length].)

A zero-cross strategy

{ AlgoGen ROC Cross — Strategy }
inputs: Length( 12 ), TrendLen( 200 );
variables: ROCval( 0 );
ROCval = RateOfChange( Close, Length );

{ Only take the zero-cross in the direction of the longer trend }
if ROCval crosses over 0 and Close > Average( Close, TrendLen ) then
    Buy next bar at market;
if ROCval crosses under 0 then
    Sell next bar at market;

Because ROC has no fixed levels, pairing the zero-cross with a trend filter is the sensible way to test it — the Strategy Performance Report will show if it helps.

Gotchas

  • Percentage vs difference. RateOfChange is the percent form; Momentum is the absolute difference. Choose deliberately.
  • No fixed extremes. ROC is unbounded — don’t hard-code overbought/oversold numbers; judge relative to recent range.
  • Manual form. 100 * (Close - Close[Length]) / Close[Length] reproduces the built-in exactly if you want to see the arithmetic.
  • Signal line. Average( ROCval, 9 ) gives a smoothed trigger for crossover entries — steadier than the raw line.
  • Coppock bonus. ROC scales up: a Coppock-style curve is WAverage( RateOfChange(Close,14) + RateOfChange(Close,11), 10 ) — the famous long-term bottom indicator, built from nothing but ROC and a weighted average.

Same indicator elsewhere: Python, MQL5, Pine Script, NinjaScript. Then backtest it in AlgoGen.


This post is educational, not financial advice. Indicators describe the past; they don’t predict the future. Backtest anything before you risk real money on it.

Sources and further reading

  1. What is EasyLanguage? (TradeStation)

Historical research from the Algogen archive. Not investment advice.

Blog

Have a strategy idea?

Describe it in plain English, preview where your rules fire, then decide whether the evidence is worth a backtest.

Keep me postedHow it works