Sound for stoploss

 

hello

i would like to know how can i have a sound when a stoploss is triggererd

cause i'm not watching all the time my pc screen but i'm in the same room with speaker on. 

 

thank you 

 

edit: Alain if you around maybe ? merci  

 
use Alert() function
 

The problem not the sound.. You can use PlaySound("file_name.wav");

The problem is how to tell the stoploss event has been occurred..

Review this code:
https://www.mql5.com/en/code/11127

MQL4 OnTrade() Alternative
MQL4 OnTrade() Alternative
  • votes: 6
  • 2014.02.17
  • Ahmed Soliman
  • www.mql5.com
This code is an Alternative of the missing OnTrade() event in MQL4.
 

you must use Hidden StopLoss

 
i had a similar EA:
#resource "\\Files\\CASHREG.wav"
string Sound;
void OnInit()
{
        ...
   Sound = "::Files\\CASHREG.WAV";
        ...
}
// And then for playing the sound its just called as following, with the need of a conditional for the SL for example, when PositionTotal() has decreased or sth like that
PlaySound(Sound);
Hope i helped you.

	          
 
arnaud pizzirani:

hello

i would like to know how can i have a sound when a stoploss is triggererd

cause i'm not watching all the time my pc screen but i'm in the same room with speaker on. 

 

thank you 

 

edit: Alain if you around maybe ? merci  


static int hot= OrdersHistoryTotal();
void OnTick()
  {
//---


if(hot < OrdersHistoryTotal())

 {
hot= OrdersHistoryTotal();

PlaySound("alert.wav"); 

}


}
Reason: