Coding Issue: Repeated Trades without Closure at Inappropriate Times and Increasing Trade Ticket Numbers
- Don't open a new handle on every tick! Your PC or at least the terminal will crash.
- Look her how it is done properly: https://www.mql5.com/de/docs/indicators/ima
- Maybe you should learn MQL5:
https://www.mql5.com/en/articles/496
https://www.mql5.com/en/articles/100 - Learn to debug your code: https://www.metatrader5.com/en/metaeditor/help/development/debug
- "Bear in mind there's virtually nothing that hasn't already been programmed for MT4/MT5 and is ready for you - copy & paste the fastest form to code.
=> Search in the articles: https://www.mql5.com/en/articles
=> Search in the codebase: https://www.mql5.com/en/code
=> Search in general: https://www.mql5.com/en/search or via Google with: "site:mql5.com .." (forgives misspelling)

Dokumentation zu MQL5: Technische Indikatoren / iMA
- www.mql5.com
iMA - Technische Indikatoren - Nachschlagewerk MQL5 - Nachschlagewerk über die Sprache des algothitmischen/automatischen Handels für 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 everyone, I'm facing an issue with my trading script that I need your help with. My problem is that the script keeps opening repeated trades without closing them properly, especially during inappropriate times. Another concern is that the trade ticket numbers are increasing inexplicably."
"I'm using various functions for trading within my code, all of which I've ensured are properly defined and there's no interference among them. The main function executes trading based on specific time conditions, yet despite all settings and conditions, these repeated trades keep executing."
"Has anyone ever encountered such an issue? Does anyone have any idea where the problem might stem from? I'd greatly appreciate it if you could share your experiences and guidance with me."
"Thank you for your assistance."