//+------------------------------------------------------------------+ //| trender.mq4 | //| Copyright © 2010, Yury Zinoviev | //| zinoviev.yury@gmail.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Yury Zinoviev" #property link "zinoviev.yury@gmail.com" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Green #property indicator_color2 Red #property indicator_color3 Yellow //---- buffers double g1[],g2[],g3[]; //inputs extern double tf=0; extern int ma_type=1; extern int ma_price=0; extern int ma_start=10; extern int ma_end=175; extern int ma_step=5; extern int flat=100; int dg; double r; int init() { SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2); SetIndexBuffer(0,g1); SetIndexLabel(0,"UPtrend hysto " + tf); SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2); SetIndexBuffer(1,g2); SetIndexLabel(1,"DNtrend hysto " + tf); SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY,2); SetIndexBuffer(2,g3); SetIndexLabel(2,"FLTtrend hysto " + tf); SetLevelValue(0,0); SetLevelValue(0,flat); SetLevelValue(1,(-1*flat)); IndicatorShortName("trend hystogramm"); ArrayInitialize(g1,0); ArrayInitialize(g2,0); ArrayInitialize(g3,0); dg=mult(Symbol()); if(tf!=0)r=tf/Period();else r=1; return(0); } int deinit() { return(0); } int start() { int i,j,k; int counted_bars; double ma,ma2,matotal; string sy=Symbol(); double pnt=MarketInfo(sy,MODE_POINT); counted_bars=IndicatorCounted(); i=Bars-counted_bars-1; ma=iMA(sy,tf,ma_start,0,ma_type,ma_price,MathFloor(i/r)); while(i>=0) { k=ma_start; matotal=0; int ii=MathFloor(i/r); ma=iMA(sy,tf,k,0,ma_type,ma_price,ii); int upcheck=0,dncheck=0; while(k