//+------------------------------------------------------------------+
//| ma_2010.mq4 |
//| Copyright ?2011, MetaQuotes Software Corp. |
//| [|
//+------------------------------------------------------------------+
#property copyright "Copyright ?2011, MetaQuotes Software Corp."
#property link ""
//--- input parameters
extern color big_ma=24;
extern color small_ma=10;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int start()
{
double bigma=iMA(Symbol(),0,big_ma,0,MODE_EMA,PRICE_CLOSE,0);
double smallma=iMA(Symbol(),0,small_ma,0,MODE_EMA,PRICE_CLOSE,0);
double bigmap=iMA(Symbol(),0,big_ma,0,MODE_EMA,PRICE_CLOSE,1);
double smallmap=iMA(Symbol(),0,small_ma,0,MODE_EMA,PRICE_CLOSE,1);
if((smallma<bigma)&&(smallmap>bigmap))//死叉
{
if(OrdersTotal()==0)
{
OrderSend(Symbol(),OP_SELL,0.13,Bid,10,Bid+900*Point,Bid+650*Point,"sell",1,0,Blue);
}
}
if((smallma>bigma)&&(smallmap<bigmap))//金叉
{
if(OrdersTotal()==0)
{
OrderSend(Symbol(),OP_BUY,0.13,Ask,10,Ask-900*Point,Ask+650*Point,"buy",1,0,Red);
}
}
return(0);
}
//+------------------------------------------------------------------+
|