//+------------------------------------------------------------------+ //| WOOOLF.mq4 | //| Copyright © 2010, Victor Nicolaev | //| vinin.ucoz.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Victor Nicolaev" #property link "vinin.ucoz.ru" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit=Bars-counted_bars; if (limit>1) { limit=Bars-2; ExtMapBuffer1[Bars-1]=Open[Bars-1]; ExtMapBuffer1[Bars-1]=Open[Bars-1]; double tmp=Close[Bars-1]-Open[Bars-1]; if (tmp<0) ExtMapBuffer1[Bars-1]=ExtMapBuffer1[Bars-1]-tmp; else if (tmp>0) ExtMapBuffer2[Bars-1]=ExtMapBuffer2[Bars-1]-tmp; } for (int i=limit;i>=0;i--) { tmp=Close[i]-Open[i]; ExtMapBuffer1[i]=ExtMapBuffer1[i+1]; ExtMapBuffer2[i]=ExtMapBuffer2[i+1]; if (TimeDay(Time[i])!=TimeDay(Time[i+1])) { ExtMapBuffer1[i]=Open[i]; ExtMapBuffer2[i]=Open[i]; if (tmp<0) ExtMapBuffer1[i]=Open[i]-tmp; else if (tmp>0) ExtMapBuffer2[i]=Open[i]-tmp; } else { if (tmp<0) ExtMapBuffer1[i]=ExtMapBuffer1[i+1]-tmp; else if (tmp>0) ExtMapBuffer2[i]=ExtMapBuffer2[i+1]-tmp; } } return(0); } //+------------------------------------------------------------------+