Download MetaTrader 5

Sound Alert

To add comments, please log in or register
RussB
19
RussB  
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?
HongDi s& t development co.,ltd.
1603
hongbin fei  
you should set a var to recode the order's count, when it is decreased, then play a sound
onewithzachy
2269
onewithzachy  
codeidea:
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
To add comments, please log in or register