Download MetaTrader 5

Is it possible to access push notifications on cell phone from EA?

To add comments, please log in or register
Grzegorz Korycki
53502
Grzegorz Korycki 2014.03.17 21:22 
My question is like in the title. I want to be able to send informations also on the cell phone from the EA other than buy or sell transactions. (informing user of changing market conditions in selected time-frames) Is it possible in Metatrader 5? I tried with Alert(), but it is not beeing "pushed".
Trinh Dat
37677
Trinh Dat 2014.03.18 03:38  
you need use : SendNotification(..)
Mehrdad Shiri
4512
Mehrdad Shiri 2014.03.18 08:31  

hi; i write below and use it in all my indicator.

uint counterBUY=0;
uint counterSELL=0;
double Ask,Bid;
string text,sAsk,sBid,sPeriod;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
input string s99="-----------------------------------------------";      // ----------- ALARM Settings -----------------
input uint Numberof_Alerts_Maximum_Iterations=2;
input bool On_Push = true;                        //allow to send push-messages
input bool On_Email = true;                       //allow to send e-mail messages
input bool On_Alert= true;                        //allow to put alert
input bool On_Play_Sound = true;                  //allow to put sound signal
input string NameFileSound="request.wav";          //name of the file with sound in "...\MetaTrader 5\Sounds"
input string  CommentSirName="your indicator name:";  //the first part of the allert comment
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,
                const datetime &Time[],
                const double   &Open[],
                const double   &High[],
                const double   &Low[],
                const double   &Close[],
                const long     &TickVolume[],
                const long     &Volume[],
                const int      &Spread[])
{

//----------------------------------------------------------------------//
   MqlDateTime tm;
   TimeToStruct(TimeCurrent(),tm);
   text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min);
   Ask=Close[0];
   Bid=Close[0]+Spread[0];
   sAsk=DoubleToString(Ask,_Digits);
   sBid=DoubleToString(Bid,_Digits);
   sPeriod=EnumToString(ChartPeriod());
   if(rates_total!=prev_calculated) {counterBUY=0;counterSELL=0;}
//----------------------------------------------------------------------//      

//----------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------- PlaySound Alert SendNotification SendMail 
//+++
     {
      if(counterBUY<Numberof_Alerts_Maximum_Iterations)
        {
         if(Indicator_Signal[0]==1&&Indicator_Signal[1]!=1) {BUY_ALARM();counterBUY++;}
        }
      if(counterSELL<Numberof_Alerts_Maximum_Iterations)
        {
         if(Indicator_Signal[0]==-1&&Indicator_Signal[1]!=-1) {SELL_ALARM();counterSELL++;}
        }
     }
//----------------------------------------------------------------------------------------------------------//
//--- done
   return(rates_total);
}
//+------------------------------------------------------------------+
//----------------------------------------------------------------------------------------------------------//
//********************************************************************************************************************
void BUY_ALARM()
  {
   if(On_Alert) Alert("BUY # ",Symbol(),"\n Period=",sPeriod,"\n Ask=",sAsk,"\n Bid=",sBid,"\n currtime=",text);
   if(On_Play_Sound) PlaySound("matrixrevolution.wav");
   if(On_Email) SendMail("BUY #",Symbol()+" Period="+sPeriod+", Ask="+sAsk+", Bid="+sBid+", currtime="+text);
   if(On_Push) SendNotification("BUY #"+Symbol()+" Period="+sPeriod+", Ask="+sAsk+", Bid="+sBid+", currtime="+text);
  }
//+------------------------------------------------------------------+
void SELL_ALARM()
  {
   if(On_Alert) Alert("SELL # ",Symbol(),"\n Period=",sPeriod,"\n Ask=",sAsk,"\n Bid=",sBid,"\n currtime=",text);
   if(On_Play_Sound) PlaySound("matrixrevolution.wav");
   if(On_Email) SendMail("SELL #",Symbol()+" Period="+sPeriod+", Ask="+sAsk+", Bid="+sBid+", currtime="+text);
   if(On_Push) SendNotification("SELL #"+Symbol()+" Period="+sPeriod+", Ask="+sAsk+", Bid="+sBid+", currtime="+text);
  }
//********************************************************************************************************************
//----------------------------------------------------------------------------------------------------------//

https://www.mql5.com/en/code/1868/34272#!tab=code

Grzegorz Korycki
53502
Grzegorz Korycki 2014.03.18 08:35  
Thanks for your responses! Very detailed answer TIMisthebest. You are the best :) (or Tim is)
Mehrdad Shiri
4512
Mehrdad Shiri 2014.03.18 08:50  
angreeee:
Thanks for your responses! Very detailed answer TIMisthebest. You are the best :) (or Tim is)

you are welcome.

i learn mql5 here ; my thank's to them for all help.

To add comments, please log in or register