本人初学EA,这是我第一个均线EA,编译时出现的一个错误始终找不出来,请各位大虾帮忙指正。小弟不甚感激!源码如下:
#define MAGICMA 9999
extern double Lots=0.1;
extern double ma1=5;
extern double ma2=15;
extern double ma3=132;
extern double 移动止损=15;
extern double 止损=10;
extern double 滑点=0.5;
datetime 限制下单次数=0;
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
int start()
{int total;
total = OrdersTotal();
if (total=0)
{
if (限制下单次数!=Time[0]&&iMA(NULL,0,ma1,0,MODE_EMA,PRICE_CLOSE,0)>iMA(NULL,0,ma2,0,MODE_EMA,PRICE_CLOSE,0)&&
Close[2]iMA(NULL,0,ma3,0,MODE_EMA,PRICE_CLOSE,1)&&
Close[0]>iMA(NULL,0,ma3,0,MODE_EMA,PRICE_CLOSE,0))
{OrderSend(Symbol(),OP_BUY,Lots,Ask,滑点,Ask-止损,0,\"倚天屠龙系统\",MAGICMA,0,Green);
限制下单次数=Time[0];}
if (限制下单次数!=Time[0]&&iMA(NULL,0,ma1,0,MODE_EMA,PRICE_CLOSE,0)iMA(NULL,0,ma3,0,MODE_EMA,PRICE_CLOSE,2)&&
Close[1]
iMA(NULL,0,ma3,0,MODE_EMA,PRICE_CLOSE,0))
{OrderSend(Symbol(),OP_SELL,Lots,Bid,滑点,Bid+止损,0,\"倚天屠龙系统\",MAGICMA,0,Green);
限制下单次数=Time[0];}
return(0);}
int i=0;
if (total > 0 )
{
for(i=total-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()==MAGICMA )
{
if(OrderType()==OP_BUY)
{
if(Close[0]iMA(NULL,0,ma3,0,MODE_EMA,PRICE_CLOSE,0))
{
OrderClose(OrderTicket(),OrderLots(),Close,1,White);
}
else if(iMA(NULL,0,ma1,0,MODE_EMA,PRICE_CLOSE,0)>iMA(NULL,0,ma2,0,MODE_EMA,PRICE_CLOSE,0))
{
OrderClose(OrderTicket(),OrderLots(),Close,1,White);
}
else if (Bid>OrderOpenPrice()+移动止损)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+移动止损,0,CLR_NONE);
}
}
}
}
return(0); }
}
//end |