MA Cross 3MACross Alert WarnSig Indicator For MT5

MA Cross 3MACross Alert WarnSig Indicator For MT5

Table Of Contents:

  1. MA Cross 3MACross Alert WarnSig Indicator For MT5
  2. 安装MA Cross 3MACross Alert WarnSig Indicator For MT5
  3. MA Cross 3MACross Alert WarnSig Indicator For MT5参数
  4. MA Cross 3MACross Alert WarnSig Indicator For MT5缓冲区
  5. 守则主要部分

MA Cross 3MACross Alert WarnSig Indicator For MT5MA Cross 3MACross Alert WarnSig Indicator For MT5计算3个不同周期的移动平均线。如果发生交叉,您将收到警报。然后,指标还将在发生交叉的那些蜡烛处在图表上绘制向上和向下的箭头。您可以根据需要配置移动平均线和警报。

FREE MA Cross 3MACross Alert WarnSig Indicator

Download the FREE MA Cross 3MACross Alert WarnSig Indicator for MT5.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

 

安装MA Cross 3MACross Alert WarnSig Indicator For MT5

通过上面的表格下载指标后,您需要解压缩zip文件。然后,您需要将文件MA Cross 3MACross Alert WarnSig.mq5复制到MT5安装的文件夹MQL5Indicators中。之后,请重启MT5,然后您将能够在指标列表中看到该指标。

MA Cross 3MACross Alert WarnSig Indicator For MT5参数

MA Cross 3MACross Alert WarnSig Indicator For MT5具有要配置的14 参数。

input int            InpMAPeriodFirst  = 5;           // Period of the first Moving Average input int            InpMAShiftFirst   = 0;           // Shift of the first Moving Average input ENUM_MA_METHOD InpMAMethodFirst  = MODE_SMMA;   // Method of the first Moving Average input int            InpMAPeriodSecond = 13;          // Period of the second Moving Average input int            InpMAShiftSecond  = 0;           // Shift of the second Moving Average input ENUM_MA_METHOD InpMAMethodSecond = MODE_SMMA;   // Method of the second Moving Average input int            InpMAPeriodThird  = 34;          // Period of the third Moving Average input int            InpMAShiftThird   = 0;           // Shift of the third Moving Average input ENUM_MA_METHOD InpMAMethodThird  = MODE_SMMA;   // Method of the third Moving Average input bool crossesOnCurrent=true; input bool alertsOn        =true; input bool alertsMessage   =true; input bool alertsSound     =false; input bool alertsEmail     =false; 

MA Cross 3MACross Alert WarnSig Indicator For MT5缓冲区

MA Cross 3MACross Alert WarnSig Indicator For MT5提供4 缓冲区。

SetIndexBuffer(0,CrossUp,INDICATOR_DATA); SetIndexBuffer(1,CrossDown,INDICATOR_DATA); SetIndexBuffer(2,CrossGhostUp,INDICATOR_DATA); SetIndexBuffer(3,CrossGhostDown,INDICATOR_DATA); 

守则主要部分

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 &tick_volume[],                 const long &volume[],                 const int &spread[])   { //---    if(rates_total lt 10 || rates_total lt InpMAPeriodThird) // very few bars       return(0);    int limit=rates_total-prev_calculated+1;    if(prev_calculated==0)       limit=rates_total-1;     ArraySetAsSeries(high,true);    ArraySetAsSeries(low,true);    ArraySetAsSeries(close,true);    ArraySetAsSeries(time,true);     for(int i=limit;i gt =0;i--)      {       //--- we look for crossing of two indicators       double   First[];       double   Second[];       double   Third[];       ArraySetAsSeries(First,true);       ArraySetAsSeries(Second,true);       ArraySetAsSeries(Third,true);       int      buffer_num=0;           // indicator buffer number        int      start_pos=i;            // start position             int      count=2;                // amount to copy        bool get_first = true;       bool get_second= true;       bool get_third = true;       get_first   = iMAGet(handle_iMA_First,buffer_num,start_pos,count,First);       get_second  = iMAGet(handle_iMA_Second,buffer_num,start_pos,count,Second);       get_third   = iMAGet(handle_iMA_Third,buffer_num,start_pos,count,Third);       if(!get_first || !get_second || !get_third)          continue;       //--- for debug in tester:       //Comment("First[0] ",DoubleToString(First[0],Digits()+1),", First[1] ",DoubleToString(First[1],Digits()+1)," ",       //        "Second[0] ",DoubleToString(Second[0],Digits()+1),", Second[1] ",DoubleToString(Second[1],Digits()+1)," ",       //        "Third[0] ",DoubleToString(Third[0],Digits()+1),", Third[1] ",DoubleToString(Third[1],Digits()+1)," ");       double Range=0.0;       int counter=i-9;       counter=(counter lt 0)?0:counter;       for(int j=counter;j lt =i;j++)          Range+=MathAbs(high[j]-low[j]);       Range/=10.0;               // "10.0"this amount of the taken values       //--- avoid current bar if not allowed to check crosses on current (i==0)       if(crossesOnCurrent==false && i==0)          continue;       //---       int    crossID = 0;       double curr    = 0.0;       double prev    = 0.0;       double point   = 0.0;       while(true)         {          curr= First[0]- Second[0];          prev= First[1]- Second[1];          point=(First[0]+First[1])/2;          if(curr*prev lt =0)            {             crossID=1;             break;            }          curr=First[0]- Third[0];          prev=First[1]- Third[1];          if(curr*prev lt =0)            {             crossID=2;             break;            }          curr=Second[0]- Third[0];          prev=Second[1]- Third[1];          point=(Second[0]+Second[1])/2;          if(curr*prev lt =0)            {             crossID=3;             break;            }          break;         }       //    the interesting thing is the direction of the crossing       //    which MA is the primary and which one the secondary       //    if you do not know that you can not determine the "direction"       //    of the cross       CrossUp[i]        =EMPTY_VALUE;       CrossDown[i]      =EMPTY_VALUE;       CrossGhostUp[i]   =EMPTY_VALUE;       CrossGhostDown[i] =EMPTY_VALUE;       if(crossID gt 0)         {          if(alertsOn)            {             double curr_norm=NormalizeDouble(curr,Digits());             if((i==0 && crossesOnCurrent==true) || (i==1 && crossesOnCurrent==false))               {                switch(crossID)                  {                   case 1:                      if(curr_norm gt 0.0)                      doAlert(" 3MACross: "First MA" crossed "Second MA" UP",time[i],close[i]);                      else if(curr_norm lt 0.0)                         doAlert(" 3MACross: "First MA" crossed "Second MA" DOWN",time[i],close[i]);                      break;                   case 2:                      if(curr_norm gt 0.0)                      doAlert(" 3MACross: "First MA" crossed "Third MA" UP",time[i],close[i]);                      else if(curr_norm lt 0.0)                         doAlert(" 3MACross: "First MA" crossed "Third MA" DOWN",time[i],close[i]);                      break;                   case 3:                      if(curr_norm gt 0.0)                      doAlert(" 3MACross: "Second MA" crossed "Third MA" UP",time[i],close[i]);                      else if(curr_norm lt 0.0)                         doAlert(" 3MACross: "Second MA" crossed "Third MA" DOWN",time[i],close[i]);                      break;                  }               }             //---             if(i==0)               {                if(curr_norm gt 0.0)                   CrossGhostUp[i]=point-Range*0.5;                else if(curr_norm lt 0.0)                   CrossGhostDown[i]=point+Range*0.5;               }             else               {                if(curr_norm gt 0.0)                   CrossUp[i]=point-Range*0.5;                else if(curr_norm lt 0.0)                   CrossDown[i]=point+Range*0.5;               }            }         }      } //--- return value of prev_calculated for next call    return(rates_total);   } //+------------------------------------------------------------------+ //| Get value of buffers for the iMA                                 | //+------------------------------------------------------------------+ bool iMAGet(int    handle_iMA,   // indicator handle              int    buffer_num,   // indicator buffer number              int    start_pos,    // start position              int    count,        // amount to copy              double &buffer[]     // target array to copy              )   { //--- reset error code     ResetLastError(); //--- fill a part of the iMABuffer array with values from the indicator buffer that has 0 index     if(CopyBuffer(handle_iMA,buffer_num,start_pos,count,buffer)!=count)      {       //--- if the copying fails, tell the error code        PrintFormat("Failed to copy data from the iMA indicator, error code %d",GetLastError());       //--- quit with zero result - it means that the indicator is considered as not calculated        return(false);      }    return(true);   } //+------------------------------------------------------------------+ //|                                                                  | //+------------------------------------------------------------------+ void doAlert(string doWhat,datetime time_last_bar,double close)   {    static string   previousAlert="nothing";    static datetime previousTime=0;    string message; //----    if(previousAlert!=doWhat || previousTime!=time_last_bar)      {       previousAlert =doWhat;       previousTime  =time_last_bar;       //        if time needed :       //        message =  StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," @",Bid," ", doWhat);       message=Symbol()+" at "+DoubleToString(close,Digits())+" "+doWhat;       if(alertsMessage)          Alert(message);       if(alertsEmail)          SendMail(Symbol()+" 3MACross:"+" M"+EnumToString(Period()),message);       if(alertsSound)          PlaySound("alert2.wav");      }   } //+------------------------------------------------------------------+ 

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.