Simple code error - *newbie* - Expert Advisors and Automated Trading - MQL5 programming forum #4 (2023)
Hello,
I made the code, which close old trade after X time from Order Open Price.
My code :
I asked ChatGTP to check for errors and it given me the code like this :
I have two question :
1. which one is more reliable and faster? mine version or ChatGTP?.
2. Can i use OrderOpenPrice directly like this int hoursDifference = (TimeCurrent() - OrderOpenTime()) / 3600;
Hi
IMO your code looks better – AI code has a mistake in syntax and names (for a start).
Yours seems to be OK. You can use OrderOpenTime directly in the hour difference formula. Though if you want to make sure that the trade would be closed. I would use some bigger slippage in OrderClose.
Best Regards

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I made the code, which close old trade after X time from Order Open Price.
My code :
I asked ChatGTP to check for errors and it given me the code like this :
I have two question :
1. which one is more reliable and faster? mine version or ChatGTP?.
2. Can i use OrderOpenPrice directly like this int hoursDifference = (TimeCurrent() - OrderOpenTime()) / 3600;