Chaikin Money Flow for MT5?

Leo  
I'm looking for the chaikin money flow for MT5, but I didn't find anything here. If exist, can you share the link to download it?
Icham Aidibe  
Leo:
I'm looking for the chaikin money flow for MT5, but I didn't find anything here. If exist, can you share the link to download it?

-----> market

Leo  
I was searching for the source code, but no problem I've already coded by myself.
cesariyz  

Hi Leo

I also couldn't find.

Could you please share your code?

Igor Faggiano  
//https://github.com/IgorFaggiano/CMF_IndicatorMQL5

#property description "Chaikin Money Flow"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots   1
#property indicator_level1  0

#property indicator_levelstyle 0
#property indicator_levelwidth 2
#property indicator_levelcolor clrDarkCyan

#property indicator_type1   DRAW_LINE
#property indicator_color1  LightSeaGreen

input int                 UsedPeriods=20; // Used Periods
input ENUM_APPLIED_VOLUME InpVolumeType=VOLUME_TICK;  // Volumes
double                    ExtCMFBuffer[];

void OnInit()
{
   SetIndexBuffer(0,ExtCMFBuffer,INDICATOR_DATA);
   IndicatorSetInteger(INDICATOR_DIGITS,5);
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,0);
   IndicatorSetString(INDICATOR_SHORTNAME,"Chaikin Money Flow("+string(UsedPeriods)+")");
}

double AD(double high,double low,double close,long volume)
{
   double res=0;
   
   if(high!=low)
      res=(2*close-high-low)/(high-low)*volume;
   
   return(res);
}

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(rates_total<UsedPeriods)
      return(0);
   
   int initialPosition = prev_calculated -1;
   if(initialPosition<0) initialPosition = 0;
   
   if(InpVolumeType==VOLUME_TICK)
   {
      for(int pos = initialPosition;pos<=rates_total-UsedPeriods;pos++)
      {
         double sumAdTotal = 0;
         long sumVolume = 0;
         
         for(int iPeriod = 0; iPeriod < UsedPeriods && !IsStopped(); ++iPeriod)
         {
            long thisTickVolume = tick_volume[pos+iPeriod];
            sumVolume += thisTickVolume;
            sumAdTotal += AD(high[pos+iPeriod], low[pos+iPeriod], close[pos+iPeriod], thisTickVolume);
         }
         
         ExtCMFBuffer[pos+UsedPeriods-1] = sumAdTotal/sumVolume;
      }
   }
   else
   {
      for(int pos = initialPosition;pos<=rates_total-UsedPeriods;pos++)
      {
         double sumAdTotal = 0;
         long sumVolume = 0;
         
         for(int iPeriod = 0; iPeriod < UsedPeriods && !IsStopped(); ++iPeriod)
         {
            long thisTickVolume = volume[pos+iPeriod];
            sumVolume += thisTickVolume;
            sumAdTotal += AD(high[pos+iPeriod], low[pos+iPeriod], close[pos+iPeriod], thisTickVolume);
         }
         
         ExtCMFBuffer[pos+UsedPeriods-1] = sumAdTotal/sumVolume;
      }
   }
   
   return (rates_total-UsedPeriods-10);
}
Igor Faggiano  
Văn Lê:
Done! Example above is done, and now working.
giobenoni  
it works, thanks a lot, it helped me
buanafijara  
Igor Faggiano:
Thank you so much
George Bryan Diaz  
How do I use the code to create the indicator?