//+------------------------------------------------------------------+ //| Bogie-RVI_SMA-IND-v1.mq4 | //| Copyright © 2010, Bogie Enterprises | //| http://www.bogie-enterpeises.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Bogie Enterprises" #property link "http://www.bogie-enterprises.com" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red extern int PeriodNumber=21; //---- buffers double OHLCBuffer1[]; double OHLCBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- 1 additional buffer used for counting. IndicatorBuffers(2); IndicatorDigits(Digits); //---- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,OHLCBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,OHLCBuffer2); //---- name for DataWindow and indicator subwindow label short_name="Bogie-RVI_SMA-IND-v1"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); //---- if(Bars<=Period()) return(0); //---- int limit=Bars-counted_bars; if(counted_bars>0) limit++; for(i=0; i=0) { OHLCBuffer1[i]=iMAOnArray(OHLCBuffer2,Bars,PeriodNumber,0,MODE_SMA,i); i--; } //---- return(0); } //+------------------------------------------------------------------+