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?
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?
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
How to make a search on the forum
https://www.mql5.com/en/forum/193510
https://www.mql5.com/en/forum/193510
How can I search for indicators and other elements in this forum?
- 2017.05.29
- www.mql5.com
How can I search for indicators in this forum? I need the Hodrick Prescott Filter for MT4. Please, if anyone can help me, I thank you in advance...
I was searching for the source code, but no problem I've already coded by myself.
Hi Leo
I also couldn't find.
Could you please share your code?
//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);
}
Văn Lê:
Done! Example above is done, and now working.
it works, thanks a lot, it helped me
Igor Faggiano:
Thank you so much
How do I use the code to create the indicator?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register