BykovTrend_Sig alert.mq4


BykovTrend_Sig alert.mq4 download link will appear after 10 seconds.



BykovTrend_Sig alert.mq4 Programming source code.

//+------------------------------------------------------------------+
//| BykovTrend_Sig.mq4 
//| Ramdass - Conversion only
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua
#property indicator_width1 0
#property indicator_width2 0

//---- input parameters
extern int RISK=3;
extern int SSP=9;
extern int CountBars=500;

extern string Alert;
extern bool UseSound = true; 
extern bool AlertSound = true; 
extern string SoundFileBuy = "alert2.wav";
extern string SoundFileSell = "email.wav";
extern bool SendMailPossible = false;
extern int SIGNAL_BAR=1;
bool SoundBuy = false;
bool SoundSell = false;

extern string Arrow;
extern int _High_ = 234;
extern int _Low_ = 233;
extern int _Distance_ = 5;

//---- buffers
double val1[];
double val2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,_High_);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,_Low_);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| BykovTrend_Sig                                                   |
//+------------------------------------------------------------------+
int start()
  {   
   SetIndexDrawBegin(0,Bars-CountBars+SSP+1);
   SetIndexDrawBegin(1,Bars-CountBars+SSP+1);
   int i,counted_bars=IndicatorCounted();
   int K;
   bool uptrend,old;
   double wpr;
   
   K=33-RISK;
//----
   if(Bars<=SSP+1) return(0);
//---- initial zero
   if(counted_bars=SSP+1) i=CountBars-counted_bars-1;
   while(i>=0)
     {
     
   wpr=iWPR(NULL,0,SSP,i);
   val1[i]=0.0; val2[i]=0.0;
   if (wpr<-100+K) uptrend=false;
   if (wpr>-K) uptrend=true;
   if ((! uptrend==old) && uptrend==true) {val2[i]=Low[i]-_Distance_*Point;}
   if ((! uptrend==old) && uptrend==false) {val1[i]=High[i]+_Distance_*Point;}
   old=uptrend;
      
      i--;
     }
     
string  message  = StringConcatenate(WindowExpertName() +""," -"," ","BUY"," -"," ",Symbol()," -"," ",Period()," ","-"," " ,TimeToStr(TimeLocal(),TIME_SECONDS)); 
string  message2 = StringConcatenate(WindowExpertName() +""," -"," ","SELL"," -"," ",Symbol()," -"," ",Period()," ","-"," " ,TimeToStr(TimeLocal(),TIME_SECONDS)); 
    //     //                              //     //
if (val2[SIGNAL_BAR] != EMPTY_VALUE && val2[SIGNAL_BAR] != 0 && SoundBuy)
{
SoundBuy = False;
if (UseSound) PlaySound (SoundFileBuy);
if(AlertSound){         
Alert(message);                             
if (SendMailPossible) SendMail(Symbol(),message); 
}              
}                 //     //                              //     //
if (!SoundBuy && (val2[SIGNAL_BAR] == EMPTY_VALUE || val2[SIGNAL_BAR] == 0)) SoundBuy = True;  
    //       //                              //       //
if (val1[SIGNAL_BAR] != EMPTY_VALUE && val1[SIGNAL_BAR] != 0 && SoundSell)
{
SoundSell = False;
if (UseSound) PlaySound (SoundFileSell); 
if(AlertSound){                    
Alert(message2);             
if (SendMailPossible) SendMail(Symbol(),message2); 
}            
}                  //       //                              //       //
if (!SoundSell && (val1[SIGNAL_BAR] == EMPTY_VALUE || val1[SIGNAL_BAR] == 0)) SoundSell = True; 
     
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Copied title and URL