HELP TO FIX POP UP NOTIFICATION AND SOUND ALERT

Sep 22, 2015 at 16:32
830浏览
2 Replies
会员从Jan 23, 2014开始   7帖子
Sep 22, 2015 at 16:32
Hello friends , please i need someone to help me fix a pop up notification and a sound alerts to this cross indicator . Thanks for your precious time. /*[[
Name := EMA Cross
Author := Hapsa
Link := https://www.metaquotes.net/
Separate Window := No
Separate Window := No
First Color := Red
First Draw Type := Symbol
First Symbol := 108
Use Second Data := Yes
Second Color := DarkOliveGreen
Second Draw Type := Symbol
Second Symbol := 108
]]*/


#property copyright 'Hapsa'
#property link ''
extern int SlowPeriod=20;
extern int FastPeriod=5;

#property indicator_buffers 3
#property indicator_chart_window
#property indicator_color1 Red
#property indicator_color2 Green
double L20[];
double L50[];
double shift=0,val1=0,val2=0;

int init()
  {
  
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(0, 108);
SetIndexArrow(1, 108);

SetIndexBuffer(0,L20);
SetIndexBuffer(1,L50);


  

//---- indicators
//----
   return(0);
  }





int start()
  {
   
   
   int counted_bars=IndicatorCounted();
//----
   int i = Bars - counted_bars - 1;
   while (i>=0)
   {
   
   val1=0;
val2=0;

double iMaSlowPrevious = iMA(NULL,0,SlowPeriod,0,MODE_EMA, PRICE_CLOSE, i-1);
double iMaSlowCurrent = iMA(NULL,0,SlowPeriod,0,MODE_EMA, PRICE_CLOSE, i);
double iMaFastPrevious = iMA(NULL,0,FastPeriod,0,MODE_EMA, PRICE_CLOSE, i-1);
double iMaFastCurrent = iMA(NULL,0,FastPeriod,0,MODE_EMA, PRICE_CLOSE, i);
   
   if (iMaFastPrevious<iMaSlowPrevious && iMaFastCurrent>iMaSlowCurrent ) val1=High[i];
   if (iMaFastPrevious>iMaSlowPrevious && iMaFastCurrent<iMaSlowCurrent ) val2=Low[i];
    L20[i]=val1+5*Point;
    L50[i]=val2-5*Point;
     i--;
   }

//----
   return(0);
会员从Sep 06, 2011开始   31帖子
Sep 23, 2015 at 05:14
Hello,

You need to use the Alert function. You can see the description here : https://docs.mql4.com/common/alert

No needs to play a sound programmatically, the popup will do it.
会员从Jan 23, 2014开始   7帖子
Sep 23, 2015 at 10:04
Thanks for that
登录 / 注册 to comment
You must be connected to Myfxbook in order to leave a comment
*商业用途和垃圾邮件将不被容忍,并可能导致账户终止。
提示:发布图片/YouTube网址会自动嵌入到您的帖子中!
提示:键入@符号,自动完成参与此讨论的用户名。