Demand Index Indicator For MT5

Demand Index Indicator For MT5

Table Of Contents:

  1. Demand Index Indicator For MT5
  2. Installing the Demand Index Indicator For MT5
  3. Parameters of the Demand Index Indicator For MT5
  4. Buffers of the Demand Index Indicator For MT5
  5. Main Parts Of The Code

The Demand Index Indicator For MT5 calculates the values based on the price action and the volume. You can choose between 10 smoothing algorithms.

FREE Demand Index Indicator

Download the FREE Demand Index Indicator for MT5.

To receive my email 100% sure: 
Put my email on your whitelist!


Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur


Installing the Demand Index 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 demand_index.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 Demand Index Indicator For MT5

The Demand Index Indicator For MT5 has 6 parameters to configure.

input Smooth_Method MA_SMethod=MODE_SMA;           // Smoothing method input int SmLength=12;                             // Smoothing depth input int SmPhase=15;                              // Smoothing parameter input Applied_price_ IPC=PRICE_QUARTER_;           // Price constant input ENUM_APPLIED_VOLUME VolumeType=VOLUME_TICK;  // Volume input int Shift=0;                                 // Horizontal shift of the indicator in bars 

Buffers of the Demand Index Indicator For MT5

The Demand Index Indicator For MT5 provides 1 buffers.


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[],     // price array of maximums of price for the indicator calculation                 const double& low[],      // price array of minimums of price for the indicator calculation                 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(rates_total lt StartBars) return(0); //---- declarations of local variables     int first,bar,Sign;    double AvgTR,Avg,VolAvg,price0,price1,WtCRatio=0.0,VolRatio;    double Constant,DMI,TempDI,BuyPres,SellPres,BuyP,SellP;    long Volume;    static double VolAvg_,BuyPres_,SellPres_; //---- calculation of the  first  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      {       first=1;                                           // starting index for calculation of all bars        BuyPres_=1;       SellPres_=1;        if(VolumeType==VOLUME_TICK) VolAvg_=double(tick_volume[0]);       else                        VolAvg_=double(volume[0]);      }     else first=prev_calculated-1; // starting index for calculation of new bars //---- restore values of the variables    VolAvg=VolAvg_;    BuyPres=BuyPres_;    SellPres=SellPres_;  //---- main indicator calculation loop    for(bar=first; bar lt rates_total; bar++)      {       //---- store values of the variables before running at the current bar       if(rates_total!=prev_calculated && bar==0)         {          VolAvg_=VolAvg;          BuyPres_=BuyPres;          SellPres_=SellPres;         }       //---- call of the PriceSeries function to get the input price  price_        price0=PriceSeries(IPC,bar,  open,low,high,close);       price1=PriceSeries(IPC,bar-1,open,low,high,close);        if(VolumeType==VOLUME_TICK) Volume=long(tick_volume[bar]);       else                        Volume=long(volume[bar]);        Avg=MathMax(high[bar],high[bar-1])-MathMin(low[bar],low[bar-1]);       AvgTR=XMA1.XMASeries(1,prev_calculated,rates_total,MA_SMethod,SmPhase,SmLength,Avg,bar,false);       VolAvg=((VolAvg *(SmLength-1))+Volume)/SmLength;        if(price0!=0 && price1!=0 && AvgTR!=0 && VolAvg!=0)          WtCRatio=(price0-price1)/MathMin(price0,price1);        if(VolAvg!=0)VolRatio=Volume/VolAvg;       else         VolRatio=1;        Constant=((price0*3)/AvgTR)*MathAbs(WtCRatio);        if(Constant gt 88) Constant=88;        Constant=VolRatio/MathExp(Constant);        if(WtCRatio gt 0)         {          BuyP=VolRatio;          SellP=Constant;         }       else         {          BuyP=Constant;          SellP=VolRatio;         }        BuyPres =((BuyPres *(SmLength-1))+BuyP )/SmLength;       SellPres=((SellPres*(SmLength-1))+SellP)/SmLength;        TempDI=+1;        if(SellPres gt BuyPres)         {          Sign=-1;          if(SellPres!=0) TempDI=BuyPres/SellPres;         }       else         {          Sign=+1;          if(BuyPres!=0) TempDI=SellPres/BuyPres;         }        TempDI*=Sign;        if(TempDI lt 0) DMI= -1-TempDI;       else        DMI =+1-TempDI;        DIBuffer[bar]=DMI*100.0;      } //----         return(rates_total);   } //+------------------------------------------------------------------+ 


About Me

I'm Mike Semlitsch the owner of My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group

Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.