//+------------------------------------------------------------------+ //| Bars - H-L excursion.mq4 | //| Copyright © 2010, PDSoftware Corp. | //| Visualizza l'escursione tra Open e Close delle Bars in Pips | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, PDSoftware Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red //---- buffers double ExtMapBuffer1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); string short_name = "Bars - O-C excursion (Pips): "; IndicatorShortName(short_name); SetLevelValue(1,10); //SetLevelValue(2,20); SetLevelValue(3,30); //SetLevelValue(10,100); SetLevelValue(4,-10); //SetLevelValue(5,-20); SetLevelValue(6,-30); //SetLevelValue(11,-100); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- check for possible errors if (counted_bars<0) return(-1); //---- last counted bar will be recounted if (counted_bars>0) counted_bars--; int pos=Bars-counted_bars; double dHigh , dLow , dResult; //---- main calculation loop while(pos>=0) { dHigh = Open[pos]; dLow = Close[pos]; dResult = (dHigh - dLow)/Point; ExtMapBuffer1[pos]= dResult ; pos--; } //---- //---- return(0); } //+------------------------------------------------------------------+