//+------------------------------------------------------------------+ //| 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 1 #property indicator_color1 Green //---- buffers double g1[]; //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,"trend hysto " + tf); SetLevelValue(0,0); SetLevelValue(0,flat); SetLevelValue(1,(-1*flat)); IndicatorShortName("trend hystogramm"); 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; while(i>=0) { k=ma_start; matotal=0; ma=iMA(sy,tf,k,0,ma_type,ma_price,MathFloor(i/r)); while(k