Звук в индикаторах

Сможете мне помочь с алертом,друзья?


  • Всего проголосовало
    67

Omukchaan

Элитный участник
Не отключается алерт, если "False" - как побороть ?
Или кто-нибудь поправит, еще лучше будет.:)

Привет!
Ограничение поставил вместе со звуком.
Скопируй код там.

Код:
//+------------------------------------------------------------------+
//|                                                 ADX Crossing.mq4 |
//|                                                             Amir |
//|                                                modified by Ctmcn |
//+------------------------------------------------------------------+
#property  copyright "Author - Amir"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightSkyBlue
#property indicator_color2 OrangeRed

//---- input parameters
extern int ADXbars=14;
extern int CountBars=350;
extern string SoundFile="Alert.wav";
extern bool UseSound_Alert=False;
bool SoundBuy  = False;
bool SoundSell = False;
//---- buffers
double val1[];
double val2[];
double b4plusdi,nowplusdi,b4minusdi,nowminusdi;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {   
   if (CountBars>=Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars);
   SetIndexDrawBegin(1,Bars-CountBars);
   int i,shift,counted_bars=IndicatorCounted();

   //---- check for possible errors
   if(counted_bars<0) return(-1);

   //---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
     } 
     
for (shift = CountBars; shift>=0; shift--)
{ 
	b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift-1);
	nowplusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift);
	b4minusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift-1);
	nowminusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_MINUSDI,shift); 

if (b4plusdi>b4minusdi && nowplusdi<nowminusdi)
{
   val1[shift]=Low[shift]-5*Point;
}
   if (val1[1] != EMPTY_VALUE && val1[1] != 0 && SoundBuy)
{
   SoundBuy = False;
   if (UseSound_Alert) PlaySound (SoundFile);
   if (UseSound_Alert) Alert("BUY - "+_Symbol+ " " + "- "+TimeFrameToString(_Period));
}
   if (!SoundBuy && (val1[1] == EMPTY_VALUE || val1[1] == 0)) SoundBuy = True;

if (b4plusdi<b4minusdi && nowplusdi>nowminusdi)
{
   val2[shift]=High[shift]+5*Point;
}
   if (val2[1] != EMPTY_VALUE && val2[1] != 0 && SoundSell)
{
   SoundSell = False;
   if (UseSound_Alert) PlaySound (SoundFile);
   if (UseSound_Alert) Alert("SELL - "+_Symbol+ " " + "- "+TimeFrameToString(_Period));
}
   if (!SoundSell && (val2[1] == EMPTY_VALUE || val2[1] == 0)) SoundSell = True;

}
   return(0);
  }
string TimeFrameToString(int tf)
{
   string tfs;

   switch(tf)
   {
      case PERIOD_M1:
         tfs = "M1"  ;
         break;
      case PERIOD_M5:
         tfs = "M5"  ;
         break;
      case PERIOD_M15:
         tfs = "M15" ;
         break;
      case PERIOD_M30:
         tfs = "M30" ;
         break;
      case PERIOD_H1:
         tfs = "H1"  ;
         break;
      case PERIOD_H4:
         tfs = "H4"  ;
         break;
      case PERIOD_D1:
         tfs = "D1"  ;
         break;
      case PERIOD_W1:
         tfs = "W1"  ;
         break;
      case PERIOD_MN1:
         tfs = "MN";
}
   return(tfs);
  }
//+------------------------------------------------------------------+
 
Последнее редактирование модератором:

EnRon

Почетный гражданин
Omukchaan большое Вам спасибо!
 
Последнее редактирование:

Prelagatay

Местный житель
Товарищи программисты добрый вечер. Добавьте пожалуйста зоне сигнализацию, а то вдруг цена убежит.
 

Вложения

  • Zone.mq4
    28 КБ · Просмотры: 108

777kos

Новичок форума
ребят прикрепите пожалуйста звук с окошком
 

Вложения

  • NLMBB.mq4
    7,2 КБ · Просмотры: 97

Omukchaan

Элитный участник
ребят прикрепите пожалуйста звук с окошком


Привет , там алерт есть но спрятали. Вывел в настройках.
Скопируй.

PHP:
//+------------------------------------------------------------------+
//|   Posted Oct 6, 2008                         NonLagMA_v7.1.2.mq4 |
//|                                |
//|           |
//|                                   E-mail: |
//|            Minor display enhancements by Big Be April 2009       |
//|            BB version has lines color change                     |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, TrendLaboratory"
#property link      "."


#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Gold //Orange
#property indicator_width1 2
#property indicator_color2 Lime
#property indicator_width2 2
#property indicator_color3 Red
#property indicator_width3 2


//---- input parameters
extern int     Price   = 6;  //Apply to Price(0-Close;1-Open;2-High;3-Low;4-Median price;5-Typical price;6-Weighted Close) 
extern int     Length  = 36;  //Period of NonLagMA
int     Displace       = 0;  //DispLace or Shift 
extern double  PctFilter = 0.0;  //Dynamic filter in decimal
string note1 ="turn on Color = 1; turn off = 0";
int     Color          = 1;  //Switch of Color mode (1-color)  
int     ColorBarBack   = 1;  //Bar back for color mode
double  Deviation      = 0;  //Up/down deviation        
extern string note2 ="turn on Alert = True; turn off = False";
extern int     AlertMode      = True;  
extern string note3 ="turn on Warning = 1; turn off = 0";
int     WarningMode    = 0;  //Sound Warning switch(0-off,1-on) 
int     WarningTicks   = 0;    //number of ticks that sound alert
//---- indicator buffers
double MABuffer[];
double UpBuffer[];
double DnBuffer[];
double trend[];
double Del[];
double AvgDel[];

double alfa[];
int Phase, Len,Cycle=4;
double Coeff, beta, t, Sum, Weight, g;
double pi = 3.1415926535;    
bool   UpTrendAlert=false, DownTrendAlert=false;
double ticks=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
  int init()
  {
   IndicatorBuffers(6);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MABuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,DnBuffer);
   SetIndexBuffer(3,trend);
   SetIndexBuffer(4,Del);
   SetIndexBuffer(5,AvgDel); 
//   string short_name;
//---- indicator line
   
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
   string short_name="NonLagMA("+Length+")";
   IndicatorShortName(short_name);
//   IndicatorShortName("NonLagMA("+Length+")");
   string Pr;
   if(Price == 0)Pr = "Cls";
   if(Price == 1)Pr = "Opn";
   SetIndexLabel(0,"NonLagMA("+Length+") "+Pr+"");
   //"+Price+"");
   SetIndexLabel(1,"Up");
   SetIndexLabel(2,"Dn");
//----
   SetIndexShift(0,Displace);
   SetIndexShift(1,Displace);
   SetIndexShift(2,Displace);
   
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexEmptyValue(2,EMPTY_VALUE);
   
   SetIndexDrawBegin(0,Length*Cycle+Length+1);
   SetIndexDrawBegin(1,Length*Cycle+Length+1);
   SetIndexDrawBegin(2,Length*Cycle+Length+1);
//----
   
   Coeff =  3*pi;
   Phase = Length-1;
   Len = Length*4 + Phase;  
   ArrayResize(alfa,Len);
   Weight=0;    
      
      for (int i=0;i<Len-1;i++)
      {
      if (i<=Phase-1) t = 1.0*i/(Phase-1);
      else t = 1.0 + (i-Phase+1)*(2.0*Cycle-1.0)/(Cycle*Length-1.0); 
      beta = MathCos(pi*t);
      g = 1.0/(Coeff*t+1);   
      if (t <= 0.5 ) g = 1;
      alfa[i] = g * beta;
      Weight += alfa[i];
      }
 
   return(0);
  }

//+------------------------------------------------------------------+
//| NonLagMA_v7.1                                                      |
//+------------------------------------------------------------------+
int start()
{
   int    i,shift, counted_bars=IndicatorCounted(),limit;
   double price;      
   if ( counted_bars > 0 )  limit=Bars-counted_bars;
   if ( counted_bars < 0 )  return(0);
   if ( counted_bars ==0 )  limit=Bars-Len-1; 
   if ( counted_bars < 1 ) 
   
   for(i=1;i<Length*Cycle+Length;i++) 
   {
   MABuffer[Bars-i]=0;    
   UpBuffer[Bars-i]=0;  
   DnBuffer[Bars-i]=0;  
   }
   
   for(shift=limit;shift>=0;shift--) 
   {	
      Sum = 0;
      for (i=0;i<=Len-1;i++)
	   { 
      price = iMA(NULL,0,1,0,3,Price,i+shift);      
      Sum += alfa[i]*price;
      
      }
   
	if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight;
   
      
      if (PctFilter>0)
      {
      Del[shift] = MathAbs(MABuffer[shift] - MABuffer[shift+1]);
   
      double sumdel=0;
      for (i=0;i<=Length-1;i++) sumdel = sumdel+Del[shift+i];
      AvgDel[shift] = sumdel/Length;
    
      double sumpow = 0;
      for (i=0;i<=Length-1;i++) sumpow+=MathPow(Del[shift+i]-AvgDel[shift+i],2);
      double StdDev = MathSqrt(sumpow/Length); 
     
      double Filter = PctFilter * StdDev;
     
      if( MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter ) MABuffer[shift]=MABuffer[shift+1];
      }
      else
      Filter=0;
      
      if (Color>0)
      {
      trend[shift]=trend[shift+1];
      if (MABuffer[shift]-MABuffer[shift+1] > Filter) trend[shift]= 1; 
      if (MABuffer[shift+1]-MABuffer[shift] > Filter) trend[shift]=-1; 
         if (trend[shift]>0)
         {  
         UpBuffer[shift] = MABuffer[shift];
         if (trend[shift+ColorBarBack]<0) UpBuffer[shift+ColorBarBack]=MABuffer[shift+ColorBarBack];
         DnBuffer[shift] = EMPTY_VALUE;
         if (WarningMode>0 && trend[shift+1]<0 && shift==0)
             if(TickCounter(WarningTicks)) 
            PlaySound("alert2.wav");
         }
         if (trend[shift]<0) 
         {
         DnBuffer[shift] = MABuffer[shift];
         if (trend[shift+ColorBarBack]>0) DnBuffer[shift+ColorBarBack]=MABuffer[shift+ColorBarBack];
         UpBuffer[shift] = EMPTY_VALUE;
         if (WarningMode>0 && trend[shift+1]>0 && shift==0) 
             if(TickCounter(WarningTicks))
            PlaySound("alert2.wav");
         }
      if(trend[1] != trend[2]) ticks = 0;
      }
   }
//----------   
   string Message;
   
   if ( trend[2]<0 && trend[1]>0 && Volume[0]>1 && !UpTrendAlert)
	{
	Message = " "+Symbol()+" M"+Period()+": Signal for BUY";
	if ( AlertMode ) Alert (Message); 
	UpTrendAlert=true; DownTrendAlert=false;
	} 
	 	  
	if ( trend[2]>0 && trend[1]<0 && Volume[0]>1 && !DownTrendAlert)
	{
	Message = " "+Symbol()+" M"+Period()+": Signal for SELL";
	if ( AlertMode ) Alert (Message); 
	DownTrendAlert=true; UpTrendAlert=false;
	} 	         
//----
	return(0);	
}

bool TickCounter(double cnt)
{
   bool result = false;
     
   if(cnt == 0 || cnt == 1) result = true;
   else
   if(cnt > 1) 
   { 
   ticks += 1;
   if(MathMod(ticks,cnt) == 0) result = true;
   }
   return(result);
}
 

Вложения

  • NLMBB.mq4
    14,4 КБ · Просмотры: 205
Последнее редактирование модератором:

Prelagatay

Местный житель
Товарищи программисты добрый вечер. Добавьте пожалуйста зоне сигнализацию, а то вдруг цена убежит.

Граждане программисты, может облагодетельствует кто и сделает алерт в индикаторе Zone. Очень пожалуйста.
 

mura

Новичок форума
Добрый день.
Помогите, пожалуйста, вставить звук в индикатор и окно
 

Вложения

  • BUY-SELL.SIGNAL.mq4
    3 КБ · Просмотры: 150

Omukchaan

Элитный участник
Добрый день.
Помогите, пожалуйста, вставить звук в индикатор и окно

Привет!

Алерт добавлен. Проверь.

PHP:
//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder                  |
//|                http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//|                                                                  |
//|  In no event will author be liable for any damages whatsoever.   |
//|                      Use at your own risk.                       |
//|                                                                  |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+

#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Aqua
#property indicator_color4 Red

extern int FastEMA = 13;
extern int SlowEMA = 21;
extern int RSIPeriod = 9;
extern bool Alerts = TRUE;
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
int gi_108 = 0;
int gi_112 = 0;
double gd_116 = 0.0;
double gd_unused_124 = 0.0;

int init() {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_92);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, g_ibuf_96);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 217);
   SetIndexBuffer(2, g_ibuf_100);
   SetIndexEmptyValue(2, 0.0);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 218);
   SetIndexBuffer(3, g_ibuf_104);
   SetIndexEmptyValue(3, 0.0);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   double irsi_8 = 0;
   bool li_16 = FALSE;
   double price_20 = 0;
   if (li_4 < 0) return (-1);
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_28 = 0; li_28 < li_0; li_28++) {
      g_ibuf_92[li_28] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, li_28);
      g_ibuf_96[li_28] = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, li_28);
      irsi_8 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, li_28);
      gd_116 = g_ibuf_92[li_28] - g_ibuf_96[li_28];
      Comment("pipdiffCurrent = " + gd_116 + " ");
      if (gd_116 > 0.0 && irsi_8 > 50.0) gi_108 = 1;
      else
         if (gd_116 < 0.0 && irsi_8 < 50.0) gi_108 = 2;
      if (gi_108 == 1 && gi_112 == 2) {
         g_ibuf_104[li_28 - 1] = High[li_28 - 1] - 5.0 * Point;
         li_16 = TRUE;
         price_20 = Ask;
      } else {
         if (gi_108 == 2 && gi_112 == 1) {
            g_ibuf_100[li_28 - 1] = Low[li_28 - 1] - 5.0 * Point;
            li_16 = TRUE;
            price_20 = Bid;
         }
      }
      gi_112 = gi_108;
      gd_unused_124 = gd_116;
   }
   if (Alerts && li_16) {
      PlaySound("alert.wav");
      if (gi_112 == 1) MessageBox("Entry point: buy at " + price_20 + "!!", "Entry Point", 0);
      if (gi_112 == 1) Alert("Entry point: buy at " + price_20 + "!!", "Entry Point", 0);
      else
         if (gi_112 == 2) MessageBox("Entry point: sell at " + price_20 + "!!", "Entry Point", 0);
         if (gi_112 == 2) Alert("Entry point: sell at " + price_20 + "!!", "Entry Point", 0);
      li_16 = FALSE;
   }
   return (0);
}
 
Последнее редактирование модератором:

mura

Новичок форума
Было бы хорошо если бы и валютную пару прописывал
 

Omukchaan

Элитный участник
Было бы хорошо если бы и валютную пару прописывал

ага забыл, вот держи.

PHP:
//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder                  |
//|                http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//|                                                                  |
//|  In no event will author be liable for any damages whatsoever.   |
//|                      Use at your own risk.                       |
//|                                                                  |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+

#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 Aqua
#property indicator_color4 Red

extern int FastEMA = 13;
extern int SlowEMA = 21;
extern int RSIPeriod = 9;
extern bool Alerts = TRUE;
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
int gi_108 = 0;
int gi_112 = 0;
double gd_116 = 0.0;
double gd_unused_124 = 0.0;

int init() {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_92);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, g_ibuf_96);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 217);
   SetIndexBuffer(2, g_ibuf_100);
   SetIndexEmptyValue(2, 0.0);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 218);
   SetIndexBuffer(3, g_ibuf_104);
   SetIndexEmptyValue(3, 0.0);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   double irsi_8 = 0;
   bool li_16 = FALSE;
   double price_20 = 0;
   if (li_4 < 0) return (-1);
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_28 = 0; li_28 < li_0; li_28++) {
      g_ibuf_92[li_28] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, li_28);
      g_ibuf_96[li_28] = iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, li_28);
      irsi_8 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, li_28);
      gd_116 = g_ibuf_92[li_28] - g_ibuf_96[li_28];
      Comment("pipdiffCurrent = " + gd_116 + " ");
      if (gd_116 > 0.0 && irsi_8 > 50.0) gi_108 = 1;
      else
         if (gd_116 < 0.0 && irsi_8 < 50.0) gi_108 = 2;
      if (gi_108 == 1 && gi_112 == 2) {
         g_ibuf_104[li_28 - 1] = High[li_28 - 1] - 5.0 * Point;
         li_16 = TRUE;
         price_20 = Ask;
      } else {
         if (gi_108 == 2 && gi_112 == 1) {
            g_ibuf_100[li_28 - 1] = Low[li_28 - 1] - 5.0 * Point;
            li_16 = TRUE;
            price_20 = Bid;
         }
      }
      gi_112 = gi_108;
      gd_unused_124 = gd_116;
   }
   if (Alerts && li_16) {
      PlaySound("alert.wav");
      if (gi_112 == 1) MessageBox(Symbol()+"  =>Entry point: buy at " + price_20 + "!!", "Entry Point", 0);
      if (gi_112 == 1) Alert(Symbol()+"  =>Entry point: buy at " + price_20 + "!!", "Entry Point", 0);
      else
         if (gi_112 == 2) MessageBox(Symbol()+"  =>Entry point: sell at " + price_20 + "!!", "Entry Point", 0);
         if (gi_112 == 2) Alert(Symbol()+"  =>Entry point: sell at " + price_20 + "!!", "Entry Point", 0);
      li_16 = FALSE;
   }
   return (0);
}
 
Последнее редактирование модератором:

mobidik

-----

Вот что Вам мешает прикрепить только готовый код, а не выкладывать сам текст кода? Это что бы по больше прокручивать страницу форума? Зачем эта показуха? А если уж так сильно хочется, то прячьте под спойлер.
 

Omukchaan

Элитный участник
Вот что Вам мешает прикрепить только готовый код, а не выкладывать сам текст кода? Это что бы по больше прокручивать страницу форума? Зачем эта показуха? А если уж так сильно хочется, то прячьте под спойлер.

так быстро для меня.
 

Omukchaan

Элитный участник
думал шо пусть смотрят и научатся код ставить алерта.
 

bot14

┳━┳
так быстро для меня.

Под спойлер можно и на мобильнике спрятать. Неужели проблема
клацнуть пару кнопочек дополнительно?
f.png
 

Omukchaan

Элитный участник
Прошу модератора спойлерить верхние коды.
Впредь буду спойлера прятать.
 
Верх