I would like MT4 to sound an alert when a position is closed (either by being stopped out or reaching a target), just like it does when I open one. It doesn't matter what the sound is, it could be the same one as I hear when I enter a position. How can I set this up?
- Instant notifications and alerts in MetaTrader 5
- MetaTrader 5 Automations
- Flexible MetaTrader 5 trading system with all order types
you should set a var to recode the order's count, when it is decreased, then play a sound
codeidea:
you should set a var to recode the order's count, when it is decreased, then play a sound
you should set a var to recode the order's count, when it is decreased, then play a sound
This MT4 question should be posted on mql4 forum. However I think it's OK since the problem the and solution can also be applied to MT5.
I disagree with codeidea. You should play a sound when the number of OrdersHistoryTotal() get increased.
If you only count OrdersTotal(), there's possibility that a position get opened at the same time with another one get closed, so the number of OrdersTotal () remain the same.
Have fun :)
Documentation on MQL5: Trade Functions / OrdersTotal
- www.mql5.com
Trade Functions / OrdersTotal - Documentation on MQL5
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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