[Closed] Is Possible To Create Price Alerts Via Code?

 

What I want to do is to create price alerts the same way we can do via MT5 Terminal Program ("Alerts" tab in the MT5, where we can define a price, condition, symbol, etc...

Is possible to do this via MQL5 somehow?

 
Yes
 
amando #:
Yes
Very impressive answer like mine. Explain it. How? 
 
unknemy: What I want to do is to create price alerts the same way we can do via MT5 Terminal Program ("Alerts" tab in the MT5, where we can define a price, condition, symbol, etc... Is possible to do this via MQL5 somehow?

Alert Displays a message in a separate window.

void  Alert(
   argument,     // first value
   ...           // other values
   );
 
Fernando Carreiro #:

Alert Displays a message in a separate window.

First, Thanks for the reply.

I know this method, but what I'm trying to do is to have the alert activated just when the current price of a symbol reaches a specific price, like we can do in the "Alerts" tab in the toolbox.

The Alert() function don't have a parameter to specify a price to trigger the alert since I know.

There is some way to implement this? Any ideas?

Thanks in advance.

 
unknemy #: First, Thanks for the reply. I know this method, but what I'm trying to do is to have the alert activated just when the current price of a symbol reaches a specific price, like we can do in the "Alerts" tab in the toolbox. The Alert() function don't have a parameter to specify a price to trigger the alert since I know. There is some way to implement this? Any ideas? Thanks in advance.

Then obviously you have to program your Indicator or EA do that. It has to monitor the price and when it reaches a specified value, it calls the Alert function. In other words you have to learn to code in MQL.

 
unknemy: I want to do is to create price alerts the same way we can do via MT5 Terminal Program ("Alerts" tab in the MT5, where we can define a price, condition, symbol, etc...

Is possible to do this via MQL5 somehow?

Of course, it's possible; code it.

static double priceUp=DBL_MAX;
double Bid=…;
if(Bid >= priceUp){ Alert(…); priceUp = DBL_MAX; }
⋮
if(isNewAlert) priceUp=…;
 
Fernando Carreiro #5:

Then obviously you have to program your Indicator or EA do that. It has to monitor the price and when it reaches a specified value, it calls the Alert function. In other words you have to learn to code in MQL.

Thanks for your reply again.

I was hoping that MQL had some function with this functionality, since you confirmed that it's not, I will try to code myself.

Thank you, I will consider this post as closed.

 
William Roeder #6:

Of course, it's possible; code it.

@Fernando Carreiro already answered that I will have to write code for this functionality since MQL doesn't have one. Thanks for the example, will be useful down the road. 

Reason: