Array Out of Range Problem

 

Hi all, 

I am coming to this forum to find some help to understand where the error on my EA can come from. 

I have developed the same EA for multiple currencies (+ XAUUSD), and I have backtested it a lot without encountering any issue. However, once I put my EA on a demo account with XAUUSD, I am getting the error "Array out of Range". 

It has been around 3 weeks that I have the EA on a demo account, for all currencies I have no issue except for XAUUSD. But the weird thing is that I am not always getting the error, since 3 weeks I got it 2 times, and I think it's cause of the spread limit/filter or maybe the trading hour limit/filter.

I have attached the file .mq5 ; the error is located on the line 11393, 30. 

If you are not able to help on this specific case; to improve my knowledge; do you have any thought on why a code is working properly on different currencies and not XAUUSD? The only difference is the trading hours and the spread to filter trades. 

If you need anything to help to resolve the issue; please let me know.

Thank you for your help,

Romain 

Files:
 
Romain C: I am coming to this forum to find some help to understand where the error on my EA can come from. I have developed the same EA for multiple currencies (+ XAUUSD), and I have backtested it a lot without encountering any issue. However, once I put my EA on a demo account with XAUUSD, I am getting the error "Array out of Range". It has been around 3 weeks that I have the EA on a demo account, for all currencies I have no issue except for XAUUSD. But the weird thing is that I am not always getting the error, since 3 weeks I got it 2 times, and I think it's cause of the spread limit/filter or maybe the trading hour limit/filter. I have attached the file .mq5 ; the error is located on the line 11393, 30. If you are not able to help on this specific case; to improve my knowledge; do you have any thought on why a code is working properly on different currencies and not XAUUSD? The only difference is the trading hours and the spread to filter trades. If you need anything to help to resolve the issue; please let me know.

Thank you for your help,

That is not your code. It is generated code by the fxdreema code builder, and most code builders are all know for producing questionable code.

The reference below is from another forum thread so point (2) and some of point (3) is not appropriate for you case, but point (1) is definitely relevant.

Forum on trading, automated trading systems and testing trading strategies

Create trail stop and breakeven function for purchase or sell grid

William Roeder, 2022.09.11 19:38

  1. EA builder, EA Builder Pro, EATree, Etasoft forex generator, ForexEAdvisor Forex Strategy Builder, ForexEAdvisor, ForexRobotAcademy.com, FX EA Builder, fxDreema, Forex Generator, FxPro, Molanis, Octa-FX Meta Editor, Online Forex Expert Advisor Generator, Strategy Builder FX, Strategy Quant, Visual Trader Studio, MQL5 Wizard, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.

    1. Since you haven't learned MQL4/5, therefor there is no common language for us to communicate.
      If we tell you what you need, you can't code it.
      If we give you the code, you don't know how to integrate it into yours.
      We are willing to HELP you when you post your attempt (using Code button) and state the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.

    2. EA builder makes bad code counting up while closing multiple orders.
      EA builder makes bad code Bars is unreliable (Max bars in chart), volume is unreliable (miss ticks.) Always use time.
      EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
      EA builder makes bad code, not adjusting for ECN brokers. pre-Build 500)
      EA builder makes bad code, not checking return codes.

    3. EATree uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)

    4. FX EA Builder makes bad code, not checking return codes.
      FX EA Builder makes bad code, loosing open tickets on terminal restart. No recovery (crash/power failure.)
      FX EA Builder makes bad code, not adjusting stops for the spread.
      FX EA Builder makes bad code, using OrdersTotal directly.

    5. FOREXEADVISOR STRATEGY BUILDER makes bad code, non-updateing global variables.
      FOREXEADVISOR STRATEGY BUILDER makes bad code, compilation errors.
      FOREXEADVISOR STRATEGY BUILDER makes bad code, not checking return codes.

    Learn to code it, or pay someone (Freelance) someone to code it.
              Hiring to write script - General - MQL5 programming forum #1 (2019)

  2. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  3. Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
              No free help (2017)

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2018)

    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
              No free help (2017)

 
Fernando Carreiro #:

That is not your code. It is generated code by the fxdreema code builder, and most code builders are all know for producing questionable code.

The reference below is from another forum thread so point (2) and some of point (3) is not appropriate for you case, but point (1) is definitely relevant.

Thank you for your message. Yes, this code has been generated by fxdreema. However, it still me who "indicated" what to use to "build" the code. 

You are right, if you give me a line of code to add/remove/replace, I will not know what to do with it. 

I simply would like to understand the issue at high level and on which part of the EA there is an issue. Moreover, why the same EA has this issue on XAUUSD but not GBPUSD (for example). 

Have you seen some EA working on some currencies but not others? 

Thank you, 

 
Romain C #: Thank you for your message. Yes, this code has been generated by fxdreema. However, it still me who "indicated" what to use to "build" the code. You are right, if you give me a line of code to add/remove/replace, I will not know what to do with it. I simply would like to understand the issue at high level and on which part of the EA there is an issue. Moreover, why the same EA has this issue on XAUUSD but not GBPUSD (for example). 

Have you seen some EA working on some currencies but not others?

As stated, this is not a "high level" issue. It is a coding problem. The generated code is of bad quality. Trying to fix it can turn out to be so troublesome that it it might be easier to just rewrite it.

We can also not just say why it works sometimes and not during other times, because that would require we debug it to find the cause.

Asking for someone here to debug it for you and to find the problem for free, is not a very pleasant thing to do.

All I can say in simple "high level" terms, is that it is simply badly coded, and bad code equals erratic and problematic functionality.

Reason: