请观看如何免费下载自动交易
请在Telegram上找到我们!
加入我们粉丝页
有趣的脚本?
因此发布一个链接 -
让其他人评价
喜欢这个脚本? 在MetaTrader 5客户端尝试它
显示:
1402
等级:
(16)
已发布:
2017.02.06 13:11
需要基于此代码的EA交易或指标吗?请在自由职业者服务中订购 进入自由职业者服务

JBrainTrend1Stop 趋势指标,有提醒、发送电子邮件和推送通知的功能。

指标的代码做出了如下改变,以实现提醒、电子邮件和推送通知的功能:

  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[],        // 用于上升趋势信号的指标缓冲区
                   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 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(SellArrow[index1] && SellArrow[index1]!=EMPTY_VALUE && BuyArrow[index] && BuyArrow[index]!=EMPTY_VALUE) 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+=_Point*Spread[index];
          string sAsk=DoubleToString(Ask,_Digits);
          string sBid=DoubleToString(Bid,_Digits);
          string sPeriod=GetStringTimeframe(ChartPeriod());
          if(SoundON) Alert("BUY signal \n Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod);
          if(EMailON) SendMail(SignalSirname+": BUY signal alert","BUY signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
          if(PushON) SendNotification(SignalSirname+": BUY signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
         }

    //---
      }
    //+------------------------------------------------------------------+
    //| 卖出信号函数                            |
    //+------------------------------------------------------------------+
    void SellSignal(string SignalSirname,      // 用于发送电子邮件和推送消息的指标名称的文字
                    double &SellArrow[],       // 用于下降趋势信号的指标缓冲区
                    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 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(BuyArrow[index1] && BuyArrow[index1]!=EMPTY_VALUE && SellArrow[index] && SellArrow[index]!=EMPTY_VALUE) 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+=_Point*Spread[index];
          string sAsk=DoubleToString(Ask,_Digits);
          string sBid=DoubleToString(Bid,_Digits);
          string sPeriod=GetStringTimeframe(ChartPeriod());
          if(SoundON) Alert("SELL signal \n Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod);
          if(EMailON) SendMail(SignalSirname+": SELL signal alert","SELL signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod);
          if(PushON) SendNotification(SignalSirname+": SELL signal at 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("JBrainTrend1Stop_Alert",BuyStopBuffer,SellStopBuffer,rates_total,prev_calculated,close,spread);
       SellSignal("JBrainTrend1Stop_Alert",SellStopBuffer,BuyStopBuffer,rates_total,prev_calculated,close,spread);
    //---  

其中 BuyStopBuffer 和 SellStopBuffer 是用于保存上升和下降趋势信号(止损买入和卖出的线)的指标缓冲区的名称,如果没有对应的趋势,指标缓冲区中应该设为0值或者 EMPTY_VALUE。

在指标代码的 OnCalculate() 模块中,只会调用一个 BuySignal() 和 SellSignal() 函数。

把 JMA.mq5 指标文件编译好放到 MQL5\Indicators。


图1. 图表上的 JBrainTrend1Stop_Alert 指标

图1. 图表上的 JBrainTrend1Stop_Alert 指标

图2. JBrainTrend1Stop_Alert 指标。生成提醒

图2. JBrainTrend1Stop_Alert 指标。生成提醒

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

Exp_JBrainTrend1Stop_ReOpen Exp_JBrainTrend1Stop_ReOpen

Exp_JBrainTrend1Stop_ReOpen 交易系统是基于 JBrainTrend1Stop 指标颜色改变的,并且有顺势加仓的功能。

DoubleUp 建仓和平仓 DoubleUp 建仓和平仓

本EA通过比较iCCI和iMACD指标进行工作。

XMA_BBxATR_Cloud_HTF XMA_BBxATR_Cloud_HTF

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

VR---SETKA---3 VR---SETKA---3

VR---SETKA---3 - MetaTrader 5 EA交易这是 VR---SETKA 的继续。本EA是基于马丁格尔原则的。网格. 马丁格尔. 只能在对冲账户上使用。