Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array out of range in 'MACDClassic.mq5' (158,64) #1

Open
m4ddav3 opened this issue Nov 13, 2020 · 4 comments
Open

array out of range in 'MACDClassic.mq5' (158,64) #1

m4ddav3 opened this issue Nov 13, 2020 · 4 comments

Comments

@m4ddav3
Copy link

m4ddav3 commented Nov 13, 2020

Hi! Love the indicator, however when I tried to incorporate it into an EA, it failed to calculate properly.

2020.11.13 23:37:04.748 2017.01.02 00:01:30 array out of range in 'MACDClassic.mq5' (158,64)

The offending line is:
ExtMacdBuffer[i] = ExtFastMaBuffer[i] - ExtSlowMaBuffer[i];
It fails on ExtSlowMaBuffer[i] almost immediately, then the indicator shows no values

@m4ddav3
Copy link
Author

m4ddav3 commented Nov 14, 2020

Added #2 to resolve this

@paulcpk
Copy link
Owner

paulcpk commented Nov 17, 2020

@m4ddav3 Thank you so much for contributing! I would like to take just a few minutes to reproduce the error and the fix, could you give me a quick explanation on how to trigger the error (is it possible to get this purely programmatically or does it also show up when using the indicator in the charts?)?

@YADenisB
Copy link

The solution is pretty simple:

   //--- calculate MACD
    if(ArraySize(ExtMacdBuffer)>=rates_total-1) 
    if(ArraySize(ExtFastMaBuffer)>=rates_total-1) 
    if(ArraySize(ExtSlowMaBuffer)>=rates_total-1) 
    for (int i = limit; i < rates_total && !IsStopped(); i++)

@xmoney
Copy link

xmoney commented May 27, 2024

@m4ddav3 Thank you so much for contributing! I would like to take just a few minutes to reproduce the error and the fix, could you give me a quick explanation on how to trigger the error (is it possible to get this purely programmatically or does it also show up when using the indicator in the charts?)?

right click -> refresh

then the indicator shows no values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants