Topic: EA MACD Error Message
Hi,
I'm getting the following error when loading some Portfolio EAs in MT5:
cannot load indicator 'MACD' [4002]
What's the problem ? Will the EA not work correctly when using MACD as entry/exit ?
Create and Test Forex Strategies
You are not logged in. Please login or register.
Forex Software → Expert Advisor Studio → EA MACD Error Message
Hi,
I'm getting the following error when loading some Portfolio EAs in MT5:
cannot load indicator 'MACD' [4002]
What's the problem ? Will the EA not work correctly when using MACD as entry/exit ?
> Will the EA not work correctly when using MACD as entry/exit ?
The EAs are working correctly with the MACD indicator for at least six years.
The problem should be other.
Please attach your expert for a test, and we will find and solve the problem.
I attached some of the EAs where I get the error.
Both experts compile, test, and run on an MT chart without errors.
Please post screenshots of the issues you experience.
See attached file.
I'm getting this error on 2 different brokers.
Hi @felix-brenkel you're welcome to the forums! I would like to point out that there appears to be an error in the code or configuration.
// MACD (Close, 34, 66, 0)
indHandlers[2][1][0] = iMACD(NULL, 0, 34, 66, 0, PRICE_CLOSE);
Fast EMA: 34
Slow EMA: 66
MACD SMA: 0
// MACD (Close, 30, 44, 0)
indHandlers[0][1][0] = iMACD(NULL, 0, 30, 44, 0, PRICE_CLOSE);
Fast EMA: 30
Slow EMA: 44
MACD SMA: 0
It seems that when calling the MACD (Moving Average Convergence Divergence) indicator, the MACD SMA (Simple Moving Average) values are set to 0. However, it is important to note that the MACD SMA should be >=2 for the indicator to function correctly.
I recently exported a portfolio expert using the MACD indicator on the MQL5 platform, and the export process went smoothly with all the values intact. However, I am puzzled as to why your source code has exported the MACD SMA values as 0. It would be beneficial for you, @Popov, to review the minimum period for MACD SMA used in the generator. It is possible that the expert advisor was generated with the parameter set to 0 for MACD SMA, leading to this discrepancy.
@viniq
Thanks for your reply.
I'm using Express Generator & afterwards EA Studio to generate the Portfolio EAs. I do not touch any Code.
So it must be a problem of the generation process ?
Added 15 and 9 to iMACD as shown: iMACD(NULL, 15, 30, 44, 9, PRICE_CLOSE);
Now EA loads onto MT5 chart with no errors shown in MT5 Experts tab at bottom of price chart.
So all you need to do is open the MT5 Editor and add the correct 'period' and 'signal period' by replacing the two zeros and press the Compile button and you should be able to use the EA's.
Evidently Express Generator is not adding the 'period' and 'signal period' to the source code of iMACD when saving strategy as an EA.
This problem should result from an earlier bug where the min indicator period could become 0 or negative. Popov fixed it already and newly created EAs should not show this problem anymore.
This problem should result from an earlier bug where the min indicator period could become 0 or negative. Popov fixed it already and newly created EAs should not show this problem anymore.
I just created new EAs tonight with the latest Express Generator and EAS, and I have this error on several symbols in MT5. It doesn't appear to be resolved yet, or the bug has returned.
I discovered the affected portfolio EAs have strategies where MACD SMA = 0. Could the new optimizer feature in Express Generator be causing this? I'm using numeric_values_steps = 20 for the optimizer.
Mr. Popov should take a look at this for sure then.
I changed the 0 to a 1 for the close of every MACD or MACD Signal for every affected strategy in the portfolio EAs and that fixed it. I suspect it won't change the performance of the strategy.
I'll examine this issue today.
Thank you for the report!
I found and fixed the issue in Express Generator v2.36.
It was in an unexpected place. Because I tried to optimize Express Generator maximally, I skipped the MACD signal line calculations because it was unnecessary. However, it exports the indicators MACD's SMA period equal to 0.
Now I fixed it to 2.
Thank you, Popov!
Thanks for the fix! If you now set it to a fixed 2, do the calculations/backtests still match with EA Studio? Thanks.
>If you now set it to a fixed 2, do the calculations/backtests still match with EA Studio?
The actual value doesn't matter because it is not used in the calculations.
However, I also added this value in the strategy's "first bar", but it is not in EA Studio.
It is fixed in Express Generator v2.37
Forex Software → Expert Advisor Studio → EA MACD Error Message
Powered by PunBB, supported by Informer Technologies, Inc.