HELP: How to make sound when price line touch horizontal line on mt5?

 
HELP: How to make sound when price line touch horizontal line on mt5?
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Hello, use alert function if close price is below/above the hl and a flag variable to detect it only once per crossing.
[Deleted]  
erna pujilestari:
HELP: How to make sound when price line touch horizontal line on mt5?


Hi, You should get the price of horizontal line, and compare with the current price.


int OnInit()
{
   EventSetTimer(1);
   return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
   EventKillTimer();
}


OnTimer()
{
double LinePrice;
double CurrentPrice;

   LinePrice=ObjectGetDouble(0,"LineName",OBJPROPP_RICE,0);
   CurrentPrice=SymbolInfoDouble(Symbol(),SYMBOL_BID);
    if(CurrentPrice>=LinePrice) PlaySound("MySoundFile.wav");
)
 
erna pujilestari: HELP: How to make sound

Perhaps you should read the manual. PlaySound
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

 
EA attached.
Files: