Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1058

 
Vitaliy Maznev:

At least logically.

Not logically...

The Alert and Playsoundfunctions are not connected in any way

 
MakarFX:

It's not logical...

Alert and Playsound are not related in any way

Do you have to have Alert with sound? Why do you so stubbornly refuse the suggestion to mute it and only use Playsound()

 
MakarFX:

It's not logical...

The Alert and Playsoundfunctions are not connected in any way

I'm a person far from programming. I don't quite understand why thePlaysound function isn't suitable for the output of your sounds. But I presented an option like that.

However, I understood from the conversation that together Alert and then Playsound partially satisfy your requirement. But there are two sounds output, right? On this basis, logically I see a solution to replace sound of Alert with silence. Then audibly only the sounds you specify will be heard.

 
Alexey Viktorov:

Do you need Alert with sound? Why do you so stubbornly refuse the suggestion to mute it and only use Playsound()

I don't refuse. Alert has set emty.wav, and in the Playsound indicator I have divided by events.
 
Vitaliy Maznev:

I am a person who is far from programming. I don't quite understand why thePlaysound function isn't suitable for the output of your sounds. But the option presented is this.

Playsound is suitable for outputting sounds, but it is not suitable for assigning Alert sounds.

The Alert is not just a sound, it is also a window with information and uses sound from МТ4 settings, i.e. you cannot assign another sound in indicator for Alert.

 
Alexey Viktorov:

Only vice versa, first Alert() then PlaySound(). Otherwise PlaySound() won't even have time to start playing, Alert() will score it.

Alert() clogs PlaySound().

what should I fix here?

void Signal(string st) {
  if (UseAlert) Alert(st);
  if (UseComment) Comment(st);
  if (UseSendMail) SendMail(WindowExpertName(), st);
  if (UseSendPush) SendNotification(st);
  if (UsePrint) Print(st);
  if (UseSound) PlaySound(sotFileName);
}

Or here

        if (StringLen(sh)>0) st=sh+st;
        Signal(st);
 
MakarFX:

Alert() blocks PlaySound()

what needs to be fixed here?

Or here.

I haven't used either Alert() or PlaySound() in about 10 years. But as far as I remember, Alert() has very short sound and PlaySound() should work without problems. I don't even know what to advise... Sleep doesn't work in indicators. Maybe you'd better replace Alert() with MessageBox() and PlaySound() after it.

I have the notifications configured like this


 
Alexey Viktorov:

Maybe better replace Alert() with MessageBox() and PlaySound() after it.

Made a change

void Signal(string st) {
  if (UseAlert) MessageBox(st,Symbol(),1);
  if (UseComment) Comment(st);
  if (UseSendMail) SendMail(WindowExpertName(), st);
  if (UseSendPush) SendNotification(st);
  if (UsePrint) Print(st);
  if (UseSound) PlaySound(sotFileName);
}
Doesn't display any messages(
 
MakarFX:

Made a change

Doesn't display any message(

Do you understand how to check that your actions are correct? I don't think I do. Have you read anything about this function? Have you read that it doesn't work in the tester like Alert() does or is it your business to replace it, and leave it to those who advise you to figure it out?

Fortunately, it was written without errors. Why is it not working, go to the club of telepaths.

 
Alexey Viktorov:

Do you understand how to check that your actions are correct? I don't think so. Have you read anything about this function? Have you read that it doesn't work in the Strategy Tester like Alert() does or you should replace it.

Fortunately, it's written without errors. Why isn't it called, please contact the telepath club.

I'm not a programmer, I edit the indicator for my own convenience. I checked it not in the tester, but in real time.

By the way, there are no telepaths.

If you know which of available indicators use this function, please advise, maybe I will understand it myself.

Thank you