ADXVMA Binary Indicator For MT5
Table Of Contents:
- ADXVMA Binary Indicator For MT5
- Installing the ADXVMA Binary Indicator For MT5
- Parameters of the ADXVMA Binary Indicator For MT5
- Buffers of the ADXVMA Binary Indicator For MT5
- Main Parts Of The Code
The ADXVMA Binary Indicator For MT5 is a very unique tool that defines the uptrend with +1 value and the downtrend with the -1 value. However, the indicator doesn’t give any precise information to execute the trades. This tool works best when you use the trailing stop loss to maximize the profit. Since the indicator data is very sensitive to slight price movement, you must learn to use this tool in the daily and weekly time frame. No matter how convincing the trade setup is, you should limit the risk to 2% in each trade. If required, open a demo account to learn its use without losing any real money.
Installing the ADXVMA Binary 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 ADXVMA binary.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 ADXVMA Binary Indicator For MT5
The ADXVMA Binary Indicator For MT5 has 2 parameters to configure.
input double inpPeriod = 14; // Period input ENUM_APPLIED_PRICE inpPrice = PRICE_MEDIAN; // Price
Buffers of the ADXVMA Binary Indicator For MT5
The ADXVMA Binary Indicator For MT5 provides 2 buffers.
SetIndexBuffer(0,val,INDICATOR_DATA); SetIndexBuffer(1,adxvma,INDICATOR_CALCULATIONS);
Main Parts Of The Code
int OnCalculate(const int rates_total,const int prev_calculated,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[]) { if(Bars(_Symbol,_Period) lt rates_total) return(prev_calculated); for(int i=(int)MathMax(prev_calculated-1,0); i lt rates_total && !IsStopped(); i++) { adxvma[i]=iAdxvma(getPrice(inpPrice,open,close,high,low,i,rates_total),inpPeriod,i,rates_total); val[i] = (i gt 0) ?(adxvma[i] gt adxvma[i-1]) ? 1 :(adxvma[i] lt adxvma[i-1]) ? -1 : val[i-1]: 0; } return(rates_total); } //+------------------------------------------------------------------+ //| Custom functions | //+------------------------------------------------------------------+ #define _adxVmaInstances 1 #define _adxVmaInstancesSize 7 double adxvmaWork[][_adxVmaInstances*_adxVmaInstancesSize]; #define _adxvmaWprc 0 #define _adxvmaWpdm 1 #define _adxvmaWmdm 2 #define _adxvmaWpdi 3 #define _adxvmaWmdi 4 #define _adxvmaWout 5 #define _adxvmaWval 6 //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double iAdxvma(double price,double period,int r,int bars,int instanceNo=0) { if(ArrayRange(adxvmaWork,0)!=bars) ArrayResize(adxvmaWork,bars); instanceNo*=_adxVmaInstancesSize; // //--- // adxvmaWork[r][instanceNo+_adxvmaWprc]=price; if(r lt 1) { adxvmaWork[r][instanceNo+_adxvmaWval]=adxvmaWork[r][instanceNo+_adxvmaWprc]; return(adxvmaWork[r][_adxvmaWval]); } // //--- // double tpdm = 0; double tmdm = 0; double diff = adxvmaWork[r][instanceNo+_adxvmaWprc]-adxvmaWork[r-1][instanceNo+_adxvmaWprc]; if(diff gt 0) tpdm = diff; else tmdm = -diff; adxvmaWork[r][instanceNo+_adxvmaWpdm] = ((period-1.0)*adxvmaWork[r-1][instanceNo+_adxvmaWpdm]+tpdm)/period; adxvmaWork[r][instanceNo+_adxvmaWmdm] = ((period-1.0)*adxvmaWork[r-1][instanceNo+_adxvmaWmdm]+tmdm)/period; // //--- // double trueRange = adxvmaWork[r][instanceNo+_adxvmaWpdm]+adxvmaWork[r][instanceNo+_adxvmaWmdm]; double tpdi = 0; double tmdi = 0; if(trueRange gt 0) { tpdi = adxvmaWork[r][instanceNo+_adxvmaWpdm]/trueRange; tmdi = adxvmaWork[r][instanceNo+_adxvmaWmdm]/trueRange; } adxvmaWork[r][instanceNo+_adxvmaWpdi] = ((period-1.0)*adxvmaWork[r-1][instanceNo+_adxvmaWpdi]+tpdi)/period; adxvmaWork[r][instanceNo+_adxvmaWmdi] = ((period-1.0)*adxvmaWork[r-1][instanceNo+_adxvmaWmdi]+tmdi)/period; // //--- // double tout=0; if((adxvmaWork[r][instanceNo+_adxvmaWpdi]+adxvmaWork[r][instanceNo+_adxvmaWmdi]) gt 0) tout=MathAbs(adxvmaWork[r][instanceNo+_adxvmaWpdi]-adxvmaWork[r][instanceNo+_adxvmaWmdi])/(adxvmaWork[r][instanceNo+_adxvmaWpdi]+adxvmaWork[r][instanceNo+_adxvmaWmdi]); adxvmaWork[r][instanceNo+_adxvmaWout]=((period-1.0)*adxvmaWork[r-1][instanceNo+_adxvmaWout]+tout)/period; // //--- // double thi = MathMax(adxvmaWork[r][instanceNo+_adxvmaWout],adxvmaWork[r-1][instanceNo+_adxvmaWout]); double tlo = MathMin(adxvmaWork[r][instanceNo+_adxvmaWout],adxvmaWork[r-1][instanceNo+_adxvmaWout]); for(int j=2; j lt (int)period && r-j gt =0; j++) { thi = MathMax(adxvmaWork[r-j][instanceNo+_adxvmaWout],thi); tlo = MathMin(adxvmaWork[r-j][instanceNo+_adxvmaWout],tlo); } double vi=0; if((thi-tlo) gt 0) vi=(adxvmaWork[r][instanceNo+_adxvmaWout]-tlo)/(thi-tlo); // //--- // adxvmaWork[r][instanceNo+_adxvmaWval]=((period-vi)*adxvmaWork[r-1][instanceNo+_adxvmaWval]+vi*adxvmaWork[r][instanceNo+_adxvmaWprc])/period; return(adxvmaWork[r][instanceNo+_adxvmaWval]); } // //--- // double getPrice(ENUM_APPLIED_PRICE tprice,const double &open[],const double &close[],const double &high[],const double &low[],int i,int _bars) { if(i gt =0) switch(tprice) { case PRICE_CLOSE: return(close[i]); case PRICE_OPEN: return(open[i]); case PRICE_HIGH: return(high[i]); case PRICE_LOW: return(low[i]); case PRICE_MEDIAN: return((high[i]+low[i])/2.0); case PRICE_TYPICAL: return((high[i]+low[i]+close[i])/3.0); case PRICE_WEIGHTED: return((high[i]+low[i]+close[i]+close[i])/4.0); } return(0); } //+------------------------------------------------------------------+