请观看如何免费下载自动交易
请在Telegram上找到我们!
加入我们粉丝页
有趣的脚本?
因此发布一个链接 -
让其他人评价
喜欢这个脚本? 在MetaTrader 5客户端尝试它
指标

RJTX_Matches_Smoothed_Alert - MetaTrader 5脚本

显示:
1057
等级:
(14)
已发布:
2019.01.04 12:05
已更新:
2023.03.29 14:35
\MQL5\Include\
需要基于此代码的EA交易或指标吗?请在自由职业者服务中订购 进入自由职业者服务

实际作者:

Rafael Jimenez Tocino

包含了提醒、电子邮件和推送通知的 RJTX_Matches_Smoothed 指标。

为了实现提醒、电子邮件信息和推送通知,对指标代码做出了以下变动。

  1. 引入了新的输入参数
    input uint NumberofBar=1;                 // 传递信号的柱编号
    input bool SoundON=true;                  // 允许提醒
    input uint NumberofAlerts=2;              // 提醒数量
    input bool EMailON=false;                 // 允许发送电子邮件信号
    input bool PushON=false;                  // 允许发送信号到移动设备


  2. 在指标代码末尾增加了三个新函数: BuySignal(), SellSignal() 和 GetStringTimeframe()
    //+------------------------------------------------------------------+
    //| 买入信号函数                                                       |
    //+------------------------------------------------------------------+
    void BuySignal(string SignalSirname,      // 用于电子邮件和提醒的指标名称
                   double &BuyArrow[],        // 买入信号的指标缓冲区
                   const int Rates_total,     // 当前柱数
                   const int Prev_calculated, // 前一分时的柱数
                   const double &Close[],     // 收盘价
                   const int &Spread[])       // 点差
      {
    //---
       static uint counter=0;
       if(Rates_total!=Prev_calculated) counter=0;
    
       bool BuySignal=false;
       bool SeriesTest=ArrayGetAsSeries(BuyArrow);
       int index,index1;
       if(SeriesTest)
        {
         index=int(NumberofBar);
         index1=index+1;
        }
       else
         {
          index=Rates_total-int(NumberofBar)-1;
          index1=index-1;
         }
       if(!BuyArrow[index1] && BuyArrow[index]) BuySignal=true;
       if(BuySignal && counter<=NumberofAlerts)
         {
          counter++;
          MqlDateTime tm;
          TimeToStruct(TimeCurrent(),tm);
          string text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min);
          SeriesTest=ArrayGetAsSeries(Close);
          if(SeriesTest) index=int(NumberofBar);
          else index=Rates_total-int(NumberofBar)-1;
          double Ask=Close[index];
          double Bid=Close[index];
          SeriesTest=ArrayGetAsSeries(Spread);
          if(SeriesTest) index=int(NumberofBar);
          else index=Rates_total-int(NumberofBar)-1;
          Bid+=Spread[index]*_Point;
          string sAsk=DoubleToString(Ask,_Digits);
          string sBid=DoubleToString(Bid,_Digits);
          string sPeriod=GetStringTimeframe(ChartPeriod());
          if(SoundON) Alert("买入信号 \n Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod);
          if(EMailON) SendMail(SignalSirname+": 买入信号提醒","买入信号位于 Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
          if(PushON) SendNotification(SignalSirname+": 买入信号位于 Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
         }
    
    //---
      }
    //+------------------------------------------------------------------+
    //| 卖出信号函数                                                       |
    //+------------------------------------------------------------------+
    void SellSignal(string SignalSirname,      // 用于电子邮件和推送通知的指标名称
                    double &SellArrow[],       // 卖出信号的指标缓冲区
                    const int Rates_total,     // 当前柱数
                    const int Prev_calculated, // 前一分时的柱数
                    const double &Close[],     // 收盘价
                    const int &Spread[])       // 点差
      {
    //---
       static uint counter=0;
       if(Rates_total!=Prev_calculated) counter=0;
    
       bool SellSignal=false;
       bool SeriesTest=ArrayGetAsSeries(SellArrow);
       int index,index1;
       if(SeriesTest)
        {
         index=int(NumberofBar);
         index1=index+1;
        }
       else
         {
          index=Rates_total-int(NumberofBar)-1;
          index1=index-1;
         }
       if(!SellArrow[index1] && SellArrow[index]) SellSignal=true;
       if(SellSignal && counter<=NumberofAlerts)
         {
          counter++;
          MqlDateTime tm;
          TimeToStruct(TimeCurrent(),tm);
          string text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min);
          SeriesTest=ArrayGetAsSeries(Close);
          if(SeriesTest) index=int(NumberofBar);
          else index=Rates_total-int(NumberofBar)-1;
          double Ask=Close[index];
          double Bid=Close[index];
          SeriesTest=ArrayGetAsSeries(Spread);
          if(SeriesTest) index=int(NumberofBar);
          else index=Rates_total-int(NumberofBar)-1;
          Bid+=Spread[index]*_Point;
          string sAsk=DoubleToString(Ask,_Digits);
          string sBid=DoubleToString(Bid,_Digits);
          string sPeriod=GetStringTimeframe(ChartPeriod());
          if(SoundON) Alert("卖出信号 \n Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod);
          if(EMailON) SendMail(SignalSirname+": 卖出信号提醒","卖出信号位于 Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
          if(PushON) SendNotification(SignalSirname+": 卖出信号位于 Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
         }
    //---
      }
    //+------------------------------------------------------------------+
    //|  把时段转换为字符串                                                 |
    //+------------------------------------------------------------------+
    string GetStringTimeframe(ENUM_TIMEFRAMES timeframe)
      {
    //----
       return(StringSubstr(EnumToString(timeframe),7,-1));
    //----
      }


  3. 在 OnCalculate() 部分,在指标计算循环之后增加了一些对 BuySignal() 和 SellSignal() 函数的调用
    //---     
       BuySignal("RJTX_Matches_Smoothed_Alert",BuyBuffer,rates_total,prev_calculated,close,spread);
       SellSignal("RJTX_Matches_Smoothed_Alert",SellBuffer,rates_total,prev_calculated,close,spread);
    //---


其中 BuyBuffer 和 SellBuffer 是用于保存买入和卖出信号的指标缓冲区的名称,指标缓冲区中的空值应当设为0或者 EMPTY_VALUE。

假定在指标代码中的 OnCalcuate() 部分只会调用 BuySignal() 和 SellSignal() 函数一次。

本指标使用了 SmoothAlgorithms.mqh 开发库的类 (把它复制到 <terminal_data_folder>\MQL5\Include). 类的使用在文章"不使用额外缓冲区平均价格序列用于中间计算"中有详尽介绍。

本指标最初是使用MQL4语言编写,最初是在2015年12月23日发布在代码库中。


图 1. 图表上的 RJTX_Matches_Smoothed_Alert 指标

图 1. 图表上的 RJTX_Matches_Smoothed_Alert 指标


图 2. RJTX_Matches_Smoothed_Alert 指标. 生成提醒

图 2. RJTX_Matches_Smoothed_Alert 指标. 生成提醒

由MetaQuotes Ltd译自俄语
原代码: https://www.mql5.com/ru/code/22712

HLCrossSigForWPR_HTF HLCrossSigForWPR_HTF

在输入参数中带有时段选择选项的 HLCrossSigForWPR 指标

BestInterval BestInterval

这个开发库用于计算最佳的交易时间段。

RJTX_Matches_Smoothed_Alert_xx RJTX_Matches_Smoothed_Alert_xx

RJTX_Matches_Smoothed_Alert 指标含有提醒、电子邮件和推送通知输入变量可以替换显示的指标符号

VZO VZO

VZO 指标