MQL5 Editor Issues

 

Trying to write a custom script in MQL% Editor. But I always get an error message when I compile. I have double checked the code and it is well-written, as other programmers and even AI confirm that there are no issues with the way the code is written. Yet MQL5 compile gives error feedback. Someone should pls help, Thanks

 
The compiler doesn't lie. Something wrong. AI mixes up MT4 code with MT5, and it thinks it's writing correct code
 
FortunateFortune:

Trying to write a custom script in MQL% Editor. But I always get an error message when I compile. I have double checked the code and it is well-written, as other programmers and even AI confirm that there are no issues with the way the code is written. Yet MQL5 compile gives error feedback. Someone should pls help, Thanks

then post the code using </> (ALT-S) button or attach as a file, then you may get some help, without the code nothing can be said.

 
  1. FortunateFortune: even AI confirm that there are no issues

    Stop using ChatGPT/Copilot.
              Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)

    ChatGPT (the worst), “Bots Builder”, “EA builder”, “EA Builder Pro”, EATree, “Etasoft forex generator”, “Forex Strategy Builder”, ForexEAdvisor (aka. ForexEAdvisor STRATEGY BUILDER, and Online Forex Expert Advisor Generator), ForexRobotAcademy.com, forexsb, “FX EA Builder”, fxDreema, Forex Generator, FxPro, “LP-MOBI”, Molanis, “Octa-FX Meta Editor”, 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.

    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.

    ChatGPT
    1. Even it says do not use it for coding. * 
    2. Mixing MT4 and MT5 code together.
    3. Creating multiple OnCalculate/OnTick functions.
    4. OnCalculate returning a double.
    5. Filling buffers with zero in OnInit (they have no size yet). Setting buffer elements to zero but not setting Empty Value to correspond.
    6. Calling undefined functions.
    7. Calling MT4 functions in MT5 code.
    8. Sometimes, not using strict (MT4 code).
    9. Code that will not compile.
    10. Creating code outside of functions. * 
    11. Creating incomplete code. * 
    12. Initialization of Global variables with non-constants. * 
    13. Assigning a MT5 handle to a double or missing the buffer and bar indexes in a MT4 call. * 
    14. Useing MT4 Trade Functions without first selecting an order. * 
    15. Uses NULL in OrderSend. * 
    bot builder Creating two OnInit() functions. * 
    EA builder
    1. Counting up while closing multiple orders.
    2. Not useing time in new bar detection.
    3. Not adjusting for 4/5 digit brokers, TP/SL and slippage. * 
    4. Not checking return codes.
    EATree Uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
    ForexEAdvisor
    1. Non-updateing global variables.
    2. Compilation errors.
    3. Not checking return codes.
    4. Not reporting errors.
    FX EA Builder
    1. Not checking return codes.
    2. Loosing open tickets on terminal restart. No recovery (crash/power failure.)
    3. Not adjusting stops for the spread. * 
    4. Using OrdersTotal directly.
    5. Using the old event handlers.

  2. FortunateFortune: . Someone should pls help, Thanks

    Help you with what? You haven't stated a problem

    Do you really expect an answer? There are no mind readers here and our crystal balls are cracked, so we can't see your machine.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We can't see your broken code.

 

Hi, I was trying different money management options. I tried the last one 'Trading with optimize trading volume.


Now no matter I do I get that option on every expert no matter what option I select. How do I undo this.

The file called strange test result shows what I think is the Optimized trading volume option

The file trade test is what I used to get

I opened a new MQL5 account, and it works properly

So, I think that my version of the source code has become corrupted. 

One cannot copy source between accounts by the look of it

How do I fix this?

Files:
 
Owen Walker #:

Hi, I was trying different money management options. I tried the last one 'Trading with optimize trading volume.


Now no matter I do I get that option on every expert no matter what option I select. How do I undo this.

The file called strange test result shows what I think is the Optimized trading volume option

The file trade test is what I used to get

I opened a new MQL5 account, and it works properly

So, I think that my version of the source code has become corrupted. 

One cannot copy source between accounts by the look of it

How do I fix this?

It's very difficult to understand you. Right click any of the parameters in the tester and click "default", if that doesn't change it, restart metatrader. If that doesn't resolve it, delete the files at Tester\Cache.

Any time you have a suspicion that something is corrupted, just delete the EX5 if you have the source code, and compile again..