金叉死叉报警

//+------------------------------------------------------------------+
//|                                                    MaCrossAA.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//--- input parameters
double 下单量;
string 货币对;
double 最大下单量=100;
double 止损点数,止损价格,止损价格1;
double 止盈点数,止盈价格,止盈价格1;
int MAGIC=100;
int ticket;
int 滑点;
bool 启动报警=false;
double BUYSTOP点数距离=500;
double BUYLIMIT点数距离=500;
double SELLSTOP点数距离=500;
double BUYSTOP线条=2,BUYLIMIT线条=1;
double SELLSTOP线条=1,SELLLIMIT线条=1;
bool 金叉=true;
bool 死叉=true;
input int Ma1;
input int Ma2;
input int Ma3;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(60);

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

   MoveCross(Ma1,Ma2);
   MoveCross(Ma2,Ma3);
  }

//+------------------------------------------------------------------+
//|均线交叉提醒                                                                  |
//+------------------------------------------------------------------+
void MoveCross(int ma1,int ma2)
  {

   货币对=Symbol();
   double MA1_0=iMA(货币对,0,ma1,0,MODE_SMA,PRICE_CLOSE,0);
   double MA1_1=iMA(货币对,0,ma1,0,MODE_SMA,PRICE_CLOSE,1);
   double MA2_0=iMA(货币对,0,ma2,0,MODE_SMA,PRICE_CLOSE,0);
   double MA2_1=iMA(货币对,0,ma2,0,MODE_SMA,PRICE_CLOSE,1);
   int date= Period();

   if(MA1_0>MA2_0&&MA1_1<MA2_1)
     {
      Print("金叉");
      Print(货币对+date+" 周期 均线金叉死叉提醒:"+ma1+" "+ma2+"周期均线形成金叉");
      SendMail(货币对+date+" 周期 均线金叉死叉提醒",ma1+" "+ma2+"周期均线形成金叉");
     }
   if(MA1_0<MA2_0&&MA1_1>MA2_1)
     {

      Print(货币对+date+" 周期 均线金叉死叉提醒:"+ma1+" "+ma2+"周期均线形成死叉");
      SendMail(货币对+date+" 周期 均线金叉死叉提醒",ma1+" "+ma2+"周期均线形成死叉");
     }

  }



//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---

  }
//+------------------------------------------------------------------+
//| Tester function                                                  |
//+------------------------------------------------------------------+
double OnTester()
  {
//---
   double ret=0.0;
//---

//---
   return(ret);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---

  }
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void 按键(string 按键名字,string txt1,string txt2,int x位置,int y位置, int 长度,int 宽度,int 角落位置,color 颜色1,color 颜色2,int 字号)
  {



  }
//+------------------------------------------------------------------+

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值