Hi all,
Severeal days ago, I had written about getting values about MACDMomentum Indicators. I couldn't get any answer by them. I really need your help.
I doenload an indicator called MACDMomentum Indicator on mql5.com. It draws MACD Value, Signal value, and Momentum_Smooth value on the chart as an indicator.
I try to get values of them in my EA. However, I don't understand and don2t know how I can get vallues from indicator.
Indicator outputs are follows; //Macd value (histogram), Signal value (yellow line), an Momentum_smooth value (red line);
The code is as follows;
I really need your help. I don't understand how I can get values, exactly.
Best,
Murat Y.
You should read the documentation https://docs.mql4.com/indicators/icustom
See example below. The code gets values at the last finished candle.
string indicatorName="..." // indicator name including path int fastEMA=12; int slowEMA=26; int signalSMA=9; int smooth=3; double lastMACD=iCustom(_Symbol,_Period,indicatorName,fastEMA,slowEMA,signalSMA,smooth,0,1); double lastSignal=iCustom(_Symbol,_Period,indicatorName,fastEMA,slowEMA,signalSMA,smooth,1,1); double lastMomentum=iCustom(_Symbol,_Period,indicatorName,fastEMA,slowEMA,signalSMA,smooth,3,1);

- docs.mql4.com
You should read the documentation https://docs.mql4.com/indicators/icustom
See example below. The code gets values at the last finished candle.
Thank you, Petr!!
Best,
Murat
Thank you Petr so much!
I try this code however I get n error about cannot open file about indicator.
My indicator is under indicator file with mq4. And, I get this message as follows;
Should I save the file as ex4?
Best,
Murat
First you should try to compile your downloaded indicator (MACD_Momentum.mq4). There must be MACD_Momentum.ex4 file in the "indicators" directory after successfully compiling. Don't rename *.mq4 files into *.ex4 files!
If you are successful (in compiling the indicator) you have to change the first line in my code into this:
string indicatorName="MACD_Momentum";
If compiling the indicator fail you have to fix bugs.
First you should try to compile your downloaded indicator (MACD_Momentum.mq4). There must be MACD_Momentum.ex4 file in the "indicators" directory after successfully compiling. Don't rename *.mq4 files into *.ex4 files!
If you are successful (in compiling the indicator) you have to change the first line in my code into this:
If compiling the indicator fail you have to fix bugs.
Thank you Petr! Problem is solved.
Best,
Murat
Hello guys,
I would like how can i save the previous value of the arrow and only replace it if there is a new arrow with his value.
Thankss
bool BlueArrow = false, RedArrow=false; int BlueArrowIndex, RedArrowIndex, Index = 0; double BlueArrowPrice, RedArrowPrice; while(!BlueArrow && !RedArrow) // end while loop when we have found the most recent red and Blue arrows { if(iCustom(Symbol(),PERIOD_CURRENT,"ema-crossover-signal",50,100,0, Index ) < 2147483647) // check for Blue arrow { BlueArrowIndex = Index; BlueArrowPrice = iCustom(NULL,0,"ema-crossover-signal",50,100,0,1); BlueArrow = true; } if(iCustom(Symbol(),PERIOD_CURRENT,"ema-crossover-signal",50,100, 1, Index ) < 2147483647) // check for Red arrow { RedArrowIndex = Index; RedArrowPrice = iCustom(NULL,0,"ema-crossover-signal",50,100, 1,1); RedArrow = true; } Index++; } Comment("RedArrowPrice ", RedArrowPrice," Barnumber Arrow ",RedArrowIndex,"\n", " BlueArrowPrice ", BlueArrowPrice," Barnumber Arrow ",BlueArrowIndex);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
Severeal days ago, I had written about getting values about MACDMomentum Indicators. I couldn't get any answer by them. I really need your help.
I doenload an indicator called MACDMomentum Indicator on mql5.com. It draws MACD Value, Signal value, and Momentum_Smooth value on the chart as an indicator.
I try to get values of them in my EA. However, I don't understand and don2t know how I can get vallues from indicator.
Indicator outputs are follows; //Macd value (histogram), Signal value (yellow line), an Momentum_smooth value (red line);
The code is as follows;
I really need your help. I don't understand how I can get values, exactly.
Best,
Murat Y.