double Alert_Higher_Level = ObjectGet( "Alert_Lines_Higher", OBJPROP_PRICE1);
if (Bid > Alert_Higher_Level && Alert_Higher_Level>0)
No....that's why i didn't understood the mouse mouvement reaction... (?)
Finally, you lead me on the good path....I have placed my function in "OnChartEvent" instead of "OnCalculate".Thank you.Now, the soud is played on tick event, but maybe too much, not like the built-in alert.How can i do it the same way please ?
Yes, on chart event would wait for a mouse move or click. The oncalculate would trigger whenever a new tick comes into the indicator. You could create a boolean variable in the top of your program and set it to true. Then when the alert and sound are triggered set it to false. Before you trigger the alert and sound, check if the value is true. The sound and alert would only happen one time this way, and you would have to reload the indicator to be able to hear the sound again.
If you want it to sound more than one time, you could create another datetime variable at the top of your program and store Time in it right away. Then every time the alert and sound are made, update the datetime variable to be Time. Add some code at the top of your oncalculate method that will change the boolean to true if enough time has passed between the datetime variable value and Time. You can check how many seconds have passed between two datetime by subtracting the older one from the newer one.
You can set and kill the timer either in Init/Deinit or on alarm event creation/expiry.