//+------------------------------------------------------------------+ //| PercentChange.mq5 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property description"PercentChange by pipPod" #property version "1.00" #property strict #property indicator_separate_window #property indicator_buffers 5 #property indicator_plots 1 //--- plot Label1 #property indicator_label1 "PercentChange" #property indicator_type1 DRAW_COLOR_CANDLES #property indicator_color1 clrLimeGreen,clrFireBrick //--- indicator buffers double OpenBuffer[]; double HighBuffer[]; double LowBuffer[]; double CloseBuffer[]; double ColorBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { IndicatorSetInteger(0,INDICATOR_DIGITS,4); //--- indicator buffers mapping SetIndexBuffer(0,OpenBuffer,INDICATOR_DATA); SetIndexBuffer(1,HighBuffer,INDICATOR_DATA); SetIndexBuffer(2,LowBuffer,INDICATOR_DATA); SetIndexBuffer(3,CloseBuffer,INDICATOR_DATA); SetIndexBuffer(4,ColorBuffer,INDICATOR_COLOR_INDEX); //--- plot properties PlotIndexSetString(0,PLOT_LABEL,"Open;High;Low;Close"); PlotIndexSetInteger(0,PLOT_SHOW_DATA,false); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { //--- int begin,count = 0; if(prev_calculated<=0 || prev_calculated>rates_total) { int barsWindow = (int)ChartGetInteger(ChartID(),CHART_VISIBLE_BARS)+50; if(rates_total