//+------------------------------------------------------------------+ //| govinda_math.mq4 | //| Copyright © 2008, WhiteForex.com | //| Written by Govinda | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, WhiteForex.com " #property link "http://www.WhiteForex.com/" #property indicator_separate_window #property indicator_minimum 0.00 #property indicator_maximum 0.08 #property indicator_buffers 2 //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //---- int ExtCountedBars=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //|------------------------------------------------------------------| int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW, 0, 0); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(1,DRAW_ARROW, 0, 0); SetIndexBuffer(1, ExtMapBuffer2); //---- SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); //---- indicator buffers mapping SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); //---- name for DataWindow and indicator subwindow label IndicatorShortName("Govinda Math"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double haOpen, haClose; if(Bars<=10) return(0); ExtCountedBars=IndicatorCounted(); //---- check for possible errors if (ExtCountedBars<0) return(-1); //---- last counted bar will be recounted if (ExtCountedBars>0) ExtCountedBars--; int pos=Bars-ExtCountedBars-1; while(pos>=0) { haOpen=(ExtMapBuffer1[pos+1]+ExtMapBuffer2[pos+1])/2; haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4; ExtMapBuffer1[pos]=haOpen; ExtMapBuffer2[pos]=haClose; pos--; } //---- return(0); } //+------------------------------------------------------------------+