您需要 登录 才可以下载或查看,没有帐号?注册
//+------------------------------------------------------------------+
//| EA4Mf.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#define MAGICMA 20100102
#property copyright
#property link
extern int ordersNum = 1000;
extern double Lots = 0.01;
extern double Lots1 = 1;
extern int FastEMA = 5;
extern int SlowEMA = 34;
extern int SignalSMA = 5;
extern int timeSinceOpen = 600;
extern int timeClose = 120;
extern double TakeProfit = 50;
extern int stopL1 = 5;
extern int stopL2 = 7;
double timeLastOpen = 0;
double timeLastOpen1 = 0;
double lotx = 0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
lotx = Lots1;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(OrdersTotal()0){//多头市场,逢低做多
if(macd2macd1 macd1 macd0){
if(CurTime() - timeLastOpen timeSinceOpen){
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0, ,MAGICMA,0,Red);//Ask+TakeProfit*Point
timeLastOpen = CurTime();
}
}
}
if(diff0=0 macd2diff1 diff1 0){
OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
if(CurTime() - timeLastOpen timeSinceOpen){
OrderSend(Symbol(),OP_BUY,lotx,Ask,3,0,0, ,MAGICMA,0,Red);
timeLastOpen = CurTime();
lotx = 6 * lotx;
}
}
}
if(OrderType()==OP_BUY){
if(diff0=0 || diff0=stopL2*Point*TakeProfit){// CurTime() - OrderOpenTime() timeX //OrderOpenPrice()-Bid =stopL*Point*TakeProfit
OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
}
}
if(OrderType()==OP_SELL){
if(OrderOpenPrice()-Ask =Point*TakeProfit||Ask-OrderOpenPrice() =stopL2*Point*TakeProfit){//Ask-OrderOpenPrice() =stopL*Point*TakeProfit
OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
}
}
//}
}
return(0);
}
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!