Time: 2013-06-23 | Download file:BOLL_ECART.mq4
//+------------------------------------------------------------------+ //| BOLL_ECART.mq4 | //| Copyright © 2011, Andrea Salvatore | //| http://www.pimpmyea.com | //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 PaleGreen #property indicator_color2 LightCoral #property indicator_color3 YellowGreen #property indicator_color4 GreenYellow #property indicator_color5 MediumAquamarine #property indicator_color6 BurlyWood #property indicator_color7 Lime #property indicator_color8 Red #property indicator_width3 2 #property indicator_width4 2 //---- indicator buffers extern int longue = 560; extern int courte = 20; extern double x_longue = 0.6; extern int smooth = 4; int limit; double Ecart_boll_haut[]; double Ecart_boll_bas[]; double smooth_boll_haut[]; double smooth_boll_bas[]; double arrow_up[]; double arrow_down[]; double arrow_up_2[]; double arrow_down_2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(8); //---- drawing settings SetIndexBuffer(0, Ecart_boll_haut); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(1, Ecart_boll_bas); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(2, smooth_boll_haut); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(3, smooth_boll_bas ); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(4, arrow_up); SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID,1); SetIndexArrow(4,233); SetIndexBuffer(5, arrow_down); SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID,1); SetIndexArrow(5,234); SetIndexBuffer(6, arrow_up_2); SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID,2); SetIndexArrow(6,233); SetIndexBuffer(7, arrow_down_2); SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID,2); SetIndexArrow(7,234); SetLevelValue(0, 0 ); // SetLevelValue(1, -0.0011); SetLevelStyle(STYLE_DASH,0,Yellow ); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i; double boll_basse, boll_haute; int z,v,w; static bool DOWN= false; static bool UP = false; //---- if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i=0; i0) counted_bars--; limit=Bars-counted_bars; for(i=0; i 0) counted_bars--; limit=Bars-counted_bars; for( i=0; i 0 ) { arrow_down[i] = smooth_boll_haut[i]; if( iMA(NULL,0,20,0,3,0,i) > iMA(NULL,0,20,0,3,0,i+1) ) DOWN = true; } if( smooth_boll_bas[i+1] > 0 && smooth_boll_bas[i] < 0 ) { arrow_up[i] = smooth_boll_bas[i]; if( iMA(NULL,0,20,0,3,0,i) < iMA(NULL,0,20,0,3,0,i+1) ) UP = true; } if( smooth_boll_haut[i+4] < 0 && smooth_boll_haut[i+3] < 0 && smooth_boll_haut[i+2] < 0 && smooth_boll_haut[i+1] < 0 && smooth_boll_haut[i] > 0 ) arrow_down_2[i] = smooth_boll_haut[i]; if( smooth_boll_bas[i+4] > 0 && smooth_boll_bas[i+3] > 0 && smooth_boll_bas[i+2] > 0 && smooth_boll_bas[i+1] > 0 && smooth_boll_bas[i] < 0 ) arrow_up_2[i] = smooth_boll_bas[i]; /* if( DOWN == true && iMA(NULL,0,20,0,3,0,i) < iMA(NULL,0,20,0,3,0,i+1) ) { arrow_down_2[i] = smooth_boll_haut[i]; DOWN = false; } if( UP == true && iMA(NULL,0,20,0,3,0,i) > iMA(NULL,0,20,0,3,0,i+1) ) { arrow_up_2[i] = smooth_boll_bas[i]; UP = false; } */ /* z = i+40; while( z<=i) { if( arrow_down[z] !=0.0 && iMA(NULL,0,20,0,3,0,z) > iMA(NULL,0,20,0,3,0,z+1) ) { w=z; while( w<=i ) { if( iMA(NULL,0,20,0,3,0,z) < iMA(NULL,0,20,0,3,0,z+1) ) arrow_up_2[z] = smooth_boll_haut[i]; w--; } z--; } } */ } //---- return(0); } //+------------------------------------------------------------------+//+------------------------------------------------------------------+ //+------------------------------------------------------------------+//+------------------------------------------------------------------+