//+------------------------------------------------------------------+
//| 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 字号)
{
}
//+------------------------------------------------------------------+