//+------------------------------------------------------------------+ //| OverTrend.mq4 | //| when-money-makes-money.com | //| when-money-makes-money.com | //+------------------------------------------------------------------+ #property copyright "when-money-makes-money.com" #property link "when-money-makes-money.com" #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 Black #property indicator_color2 Red #property indicator_color3 Blue #property indicator_color4 Red #property indicator_color5 DeepSkyBlue #property indicator_color6 Coral //---- buffers double trend[]; double ExtMapBuffer2[]; double sig.up[]; double sig.do[]; double trend.up[]; double trend.do[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,5); SetIndexBuffer(0,trend); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(2,sig.up); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(3,sig.do); SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(4,trend.up); SetIndexStyle(5,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(5,trend.do); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int p[]={5,14,28,32,60,102,162,264,326}; int start() { int counted_bars=IndicatorCounted(); //---- double tmp=0; for(int i=Bars-counted_bars-1;i>=0;i--){ tmp=0; for(int j=0;j0){ if(trend[i]>trend[i+1]){ sig.do[i]=0; sig.up[i]=trend[i]; trend.do[i]=0; trend.up[i]=0; }else{ trend.do[i]=0; trend.up[i]=trend[i]; sig.up[i]=0; sig.do[i]=0; } }else{ if(trend[i]