Please anyone has any idea or know hoe i can get an email alert on my email whenever my indicator gives an alert on my chart. I have already set up my email with metatrader 4 and i have successfully sent test message applying all the SMTP settings.Thanks.
- HOW CAN I GET EMAIL ALRETS WHEN MY INDICATOR ALERTS ME ON MY CHART
- email alert
- Harmonic Trading
karlie4nia:
Please anyone has any idea or know hoe i can get an email alert on my email whenever my indicator gives an alert on my chart. I have already set up my email with metatrader 4 and i have successfully sent test message applying all the SMTP settings.Thanks.
Please anyone has any idea or know hoe i can get an email alert on my email whenever my indicator gives an alert on my chart. I have already set up my email with metatrader 4 and i have successfully sent test message applying all the SMTP settings.Thanks.
Forum on trading, automated trading systems and testing trading strategies
TIMisthebest, 2014.03.18 08:43
hi;
below code can use for " send email & send massage to mobile & send sound and alarm " .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); } //******************************************************************************************************************** //----------------------------------------------------------------------------------------------------------//
example : https://www.mql5.com/en/code/1868
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register