Non Lag Dot Indicator For MT5
Table Of Contents:
- Non Lag Dot Indicator For MT5
- Installing the Non Lag Dot Indicator For MT5
- Parameters of the Non Lag Dot Indicator For MT5
- Buffers of the Non Lag Dot Indicator For MT5
- Main Parts Of The Code
The Non Lag Dot Indicator For MT5 is developed as a supply and demand indicator. Instead of a solid line this indicator draws a moving average with dots on the chart. During downward trends the color is violet. During upward trends green color is used.
Installing the Non Lag Dot Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file nonlagdot.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the Non Lag Dot Indicator For MT5
The Non Lag Dot Indicator For MT5 has 6 parameters to configure.
input ENUM_APPLIED_PRICE Price=PRICE_CLOSE; // Applied price input ENUM_MA_METHOD Type=MODE_SMA; // Smoothing method input int Length=10; // Indicator calculation period input int Filter= 0; input double Deviation=0; // Deviation input int Shift=0; // Horizontal shift of the indicator in bars
Buffers of the Non Lag Dot Indicator For MT5
The Non Lag Dot Indicator For MT5 provides 2 buffers.
SetIndexBuffer(0,MABuffer,INDICATOR_CALCULATIONS); SetIndexBuffer(1,ColorMABuffer,INDICATOR_COLOR_INDEX);
Main Parts Of The Code
int OnCalculate(const int rates_total, // number of bars in history at the current tick const int prev_calculated,// number of bars calculated at previous call const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //---- checking the number of bars to be enough for the calculation if(BarsCalculated(MA_Handle) lt rates_total || rates_total lt min_rates_total) return(RESET); //---- declarations of local variables int to_copy,limit,bar,trend0; double MA[],alfa,beta,t,Sum,Weight,g; static int trend1; //---- calculations of the necessary amount of data to be copied //---- and the limit starting index for the bars recalculation loop if(prev_calculated gt rates_total || prev_calculated lt =0)// checking for the first start of the indicator calculation { to_copy=rates_total; // calculated number of all bars limit=rates_total-min_rates_total-1; // starting index for calculation of all bars } else { to_copy=rates_total-prev_calculated+int(Len); // calculated number of new bars only limit=rates_total-prev_calculated; // starting index for calculation of new bars } //--- copy newly appeared data in the array if(CopyBuffer(MA_Handle,0,0,to_copy,MA) lt =0) return(RESET); //---- indexing elements in arrays as timeseries ArraySetAsSeries(MA,true); trend0=trend1; //---- main indicator calculation loop for(bar=limit; bar gt =0 && !IsStopped(); bar--) { Weight=0; Sum=0; t=0; for(int iii=0; iii lt =Len-1; iii++) { g=1.0/(Coeff*t+1); if(t lt =0.5) g=1; beta=MathCos(PI*t); alfa=g*beta; Sum+=alfa*MA[bar+iii]; Weight+=alfa; if(t lt 1) t+=dT2; else if(t lt Len-1) t+=dT1; } if(Weight gt 0) MABuffer[bar]=Kd*Sum/Weight; if(Filter gt 0) if(MathAbs(MABuffer[bar]-MABuffer[bar-1]) lt Fi) MABuffer[bar]=MABuffer[bar-1]; if(MABuffer[bar]-MABuffer[bar+1] gt Fi) trend0=+1; if(MABuffer[bar+1]-MABuffer[bar] gt Fi) trend0=-1; ColorMABuffer[bar]=0; if(trend0 gt 0) ColorMABuffer[bar]=2; if(trend0 lt 0) ColorMABuffer[bar]=1; if(bar) trend1=trend0; } //---- return(rates_total); } //+------------------------------------------------------------------+