#property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red extern int RPeriod = 10; extern bool UsePercent = FALSE; double g_ibuf_84[]; int init() { SetIndexStyle(0, DRAW_LINE); SetIndexDrawBegin(0, RPeriod); IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS) + 1.0); if (!SetIndexBuffer(0, g_ibuf_84)) Print("cannot set indicator buffers!"); IndicatorShortName("ROC(" + RPeriod + ")"); SetIndexLabel(0, "ROC"); return (0); } int start() { double ld_4; double l_iclose_12; double l_iclose_20; int li_28 = IndicatorCounted(); if (li_28 < 0) return (-1); if (li_28 > 0) li_28--; int li_0 = Bars - li_28; for (int li_32 = 0; li_32 < li_0; li_32++) { l_iclose_12 = iClose(NULL, 0, li_32); l_iclose_20 = iClose(NULL, 0, li_32 + RPeriod); ld_4 = l_iclose_12 - l_iclose_20; if (UsePercent) g_ibuf_84[li_32] = 100.0 * ld_4 / l_iclose_20; else g_ibuf_84[li_32] = ld_4; } return (0); }