//+------------------------------------------------------------------+ //| EFI.mq4 | //| TO | //| http://www.forex-tradexperts-to.narod.ru | //+------------------------------------------------------------------+ #property copyright "TO" #property link "http://www.forex-tradexperts-to.narod.ru" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Magenta extern int BARS = 1000; extern int MA_period = 13; extern int MA_method = 1; extern int applied_price = 0; double buff_1[]; double buff_2[]; int init() { IndicatorBuffers(2); SetIndexBuffer(0,buff_1); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(1,buff_2); IndicatorShortName("EFI("+MA_period+")"); return(0); } int deinit() { return(0); } int start() { int i; for (i = BARS; i >= 0 ; i -- )buff_2[i] = ( 1 - PRICE(applied_price,i+1)/PRICE(applied_price,i) )*Volume[i]; for( i = 0; i < BARS - MA_period ; i++)buff_1[i]=iMAOnArray(buff_2,0,MA_period,0,MA_method,i); return(0); } double PRICE ( int type, int count) { if ( type == 0 )return(Close[count]); if ( type == 1 )return(Open[count]); if ( type == 2 )return(High[count]); if ( type == 3 )return(Low[count]); if ( type == 4 )return((High[count]+Low[count])/2); if ( type == 5 )return((High[count]+Low[count]+Close[count])/3); if ( type == 6 )return((High[count]+Low[count]+Close[count]+Close[count])/4); }