It fails because you (and ChatGPT) have no idea of what you are doing. Hire a professional developer in the freelance section.
Coding, as well as all other jobs, cannot be improvised if you want to obtain a decent result. If a decent result is not your goal, you already obtained it!
Why did you post your coding question in the MT5 General section (a miscellaneous catch-all category) instead of the MT5 EA section (non-indicator coding)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. I have moved this thread.-
double atr_now = atr[0]; double atr_prev = atr[1];
Where did you set the indexing direction of all your arrays (before filling)?
To define the indexing direction in the time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[] and other arrays (copyXXXX functions), call the ArrayGetAsSeries() function. In order not to depend on defaults, call the ArraySetAsSeries() function for the arrays to work with.
Event Handling / OnCalculate - Reference on algorithmic/automated trading language for MetaTrader 5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello great people. Kindly help me fix the error in my EA. It fails to pick trades.