Use ACCOUNT_LOGIN:
/// on init if (login==0) login=AccountInfoInteger(ACCOUNT_LOGIN); if (login!=AccountInfoInteger(ACCOUNT_LOGIN)) { login=AccountInfoInteger(ACCOUNT_LOGIN); // new account }
Thanks so much!!! Works great!!!
Yes, I looked at this, but this phrase confused me: "...or reconnection to the trade server has occurred due to changes in the account settings"
hmm, yeah, even simpler, but I wonder about what Tecuciztecatl brought up. What do you think falls into that category?
Thanks both of you!
bunnycat: What do you think falls into that category? |
|
bunnycat: if (Orders>OrdersTotal()) { AlertOrder(maxlots); Orders=OrdersTotal(); return; } Orders=OrdersTotal(); | No OrderSelect loop with filtering means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum |

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
Hey, so I call a function on order close, but I want the alert to not be triggered if I change accounts. So for instance, I have an order open in an account, then switch to the demo, I don't want my custom alert function to trigger.
This is the end of the main EA code:
I tried putting "Orders = 0" in OnDeInit, but that didn't solve it. AlertOrder still gets called if i change accounts.
Any idea how to fix it? Thanks in advance!