//+------------------------------------------------------------------+ //| EVIndicator.mq4 | //| maam4 | //| http://www.podsystem.com | //| mod by nlenz | //+------------------------------------------------------------------+ #property copyright "maam4" #property link "http://www.podsystem.com" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Yellow #property indicator_color3 Blue //---- buffers double EV[]; double LV[]; double SV[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexBuffer(0,EV); SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);// Line style SetIndexBuffer(1,LV); SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);// Line style SetIndexBuffer(2,SV); SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);// Line style //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ //double t[]; double avg[]; int start() { int limit, i; int sum, sum2; // Bar index, number of counted bars int counted_bars=IndicatorCounted(); // Number of counted bars if(counted_bars<0) return(-1); // Check for possible errors if(counted_bars>0) counted_bars--; // The last counted bar will be recounted limit = Bars-counted_bars; // Index of first uncounted bar for(i=0; i= 0; i--) { // Is EV in current i bar greater than median? if((EV[i] < 0 && avg[i] < 0)|| (EV[i] > 0 && avg[i] > 0) && (MathAbs(EV[i]) > MathAbs(avg[i]))) { sum += EV[i]; } LV[i] = sum; if(MathAbs(EV[i]) - MathAbs(avg[i]) < 0) { // Is EV in current i bar less than median? //LV[i] = 0.0; // Allocate 0.0 for LV sum2 += EV[i]; } SV[i] = sum2; } return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Custom special close function | //+------------------------------------------------------------------+ double _hs(int i) { return(MathMax(High[i], Close[i+1])); } //+------------------------------------------------------------------+ //| Custom special low function | //+------------------------------------------------------------------+ double _ls(int i) { return(MathMin(Low[i], Low[i+1])); }