I have an EA that works well in trading accounts with some spread, but it does not function properly in trading accounts where the spread is zero. In a zero spread account, the limit orders automatically close instantly after being opened, and the EA continues to operate indefinitely. Upon reviewing the code, I discovered that there is an "if" condition that is causing the current issue. In a zero spread account, this condition evaluates to true and deletes pending orders. I'm unsure why this "if" condition is important and what its purpose is. If I remove this "if" condition, the EA works fine in both spread and zero spread accounts, but I'm concerned about potential consequences on trading performance if I remove it.
Please help me understand this code and what could be the reason behind this condition closing pending orders only in zero spread accounts. Additionally, how can I rewrite this code so that it will work in zero spread accounts the same way as in spread accounts?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello,
I have an EA that works well in trading accounts with some spread, but it does not function properly in trading accounts where the spread is zero. In a zero spread account, the limit orders automatically close instantly after being opened, and the EA continues to operate indefinitely. Upon reviewing the code, I discovered that there is an "if" condition that is causing the current issue. In a zero spread account, this condition evaluates to true and deletes pending orders. I'm unsure why this "if" condition is important and what its purpose is. If I remove this "if" condition, the EA works fine in both spread and zero spread accounts, but I'm concerned about potential consequences on trading performance if I remove it.
Here is the code :
Please help me understand this code and what could be the reason behind this condition closing pending orders only in zero spread accounts. Additionally, how can I rewrite this code so that it will work in zero spread accounts the same way as in spread accounts?