//+------------------------------------------------------------------+ //| 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(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit-=1+1; //---- double tmp=0; for(int i=limit;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]