Send Notification Question

 

I want to send a notification to my phone whenever there is an opportunity for a trade.

It seems that all I can send with the SendNotification function is just a text message - which is different from the SendMail function.

I trade on 10 different pairs.

Is there any way that I can send the Currency Pair (Symbol()) and perhaps the Time included in the text message?

 
Ernest Klokow:

I want to send a notification to my phone whenever there is an opportunity for a trade.

It seems that all I can send with the SendNotification function is just a text message - which is different from the SendMail function.

I trade on 10 different pairs.

Is there any way that I can send the Currency Pair (Symbol()) and perhaps the Time included in the text message?

you can put what you like in the text message

 
Ernest Klokow: It seems that all I can send with the SendNotification function is just a text message - which is different from the SendMail function.

How is it different? All you can send with SendMail is a text subject and a text message.

 

In SendMail I have code like the following in another EA that works:

         SendMail("Momentum System BUY trade opened ", BuyCurrPair + " Date = " + TimeToStr(TimeCurrent(),TIME_DATE) + "; " + " Time = " +  TimeToStr(TimeCurrent(),TIME_MINUTES) + "; " + "GMT = +3");

In this EA I am using the following code - but it does not give the Symbol() or other info. It just puts everything that is in the text (which makes sense).

         SendNotification("Trend-Magic SELL opportunity + Symbol() + TimeToStr(TimeCurrent(),TIME_DATE)  +  TimeToStr(TimeCurrent(),TIME_MINUTES)+ TimeToStr(TimeCurrent(),TIME_MINUTES)");

I am sure I am making some stuid error.

 
The quotes are misplaced, try this 

 SendNotification("Trend-Magic SELL opportunity "+ Symbol()+" "+ TimeToStr(TimeCurrent(),TIME_DATE)+" "+TimeToStr(TimeCurrent(),TIME_MINUTES));
  


I fixed the quotes and added spaces between words for better formatting.

 
Suggest that instead of this:
SendNotification("Trend-Magic SELL opportunity "+ Symbol()+" "+ TimeToStr(TimeCurrent(),TIME_DATE)+" "+TimeToStr(TimeCurrent(),TIME_MINUTES));

You can break it down for longer messages, note the line break for an easy to read txt...

string txt="";
txt="Trend-Magic SELL opportunity "+ Symbol()+"\n"
    + TimeToStr(TimeCurrent(),TIME_DATE)+"\n"
     +TimeToStr(TimeCurrent(),TIME_MINUTES);

SendNotification(txt);

/* ==Result==
Trend-Magic SELL opportunity EURUSD.r
2023.07.25
08:30
*/
 

Thank you so much guys!

I am going to try Andrew's solution - that seems a nice format for all of my future notifications. 

I really appreciate your help!!