下载MetaTrader 5
要添加评论,请登录注册
通过市场出售产品并追踪您的销售统计
drizzit.6
19
drizzit.6 2011.05.27 06:45 

#property copyright "lf"
#property link ""

extern int MA1 = 3;
extern int MA2 = 21;
extern int i;
extern int Ti;

int init()
{
i=0;

return;
}

int start()
{
if (iMA(NULL,0,MA1,0,3,5,0)<iMA(NULL,0,MA2,0,3,5,0)) open_sell();
if (iMA(NULL,0,MA1,0,3,5,0)>iMA(NULL,0,MA2,0,3,5,0)) open_buy();

return;
}

int open_sell()
{
if (OrdersTotal()==0) OrderSend(Symbol(),1,0.01,Bid,3,0,0,"",0,0,Yellow);
if (OrdersTotal()!=0)
for (i=1;i==OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
Ti=OrderTicket();
if (OrderType()==OP_BUY) OrderClose(Ti,OrderLots(),Bid,3,Red);
// OrderSend(Symbol(),1,0.01,Bid,3,0,0,"",0,0,Yellow);
}


return;
}


int open_buy()
{
if (OrdersTotal()==0) OrderSend(Symbol(),0,0.01,Ask,3,0,0,"",0,0,Blue);
if (OrdersTotal()!=0)
for (i=1;i==OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
Ti=OrderTicket();
if (OrderType()==OP_SELL) OrderClose(Ti,OrderLots(),Ask,3,Green);
// OrderSend(Symbol(),0,0.01,Ask,3,0,0,"",0,0,Blue);
}


return;
}
//+------------------------------------------------------------------+

trad
44
trad 2011.07.13 10:21  

if (OrderType()==OP_BUY) OrderClose(Ti,OrderLots(),Bid,3,Red);

上句中Bid改成Ask

if (OrderType()==OP_SELL) OrderClose(Ti,OrderLots(),Ask,3,Green);

上句中Ask改成Bid

/
要添加评论,请登录注册