下载MetaTrader 5
要添加评论,请登录注册
您已经开发一个应用程序了吗?在代码库中发布它!
kaven
4
kaven 2014.04.10 03:15 

新手,写的外汇套利EA,提示0错误,但是不知道会不会下单,请高手帮忙查看指正,不胜感谢,以下是源码(其中有些可能没用):


int init()

{

return(0);

}

int start()

{




double EURUSDA=MarketInfo("EURUSD",MODE_ASK);

double GBPUSDA=MarketInfo("GBPUSD",MODE_ASK);

double EURGBPA=MarketInfo("EURGBP",MODE_ASK);

double EURUSDB=MarketInfo("EURUSD",MODE_BID);

double GBPUSDB=MarketInfo("GBPUSD",MODE_BID);

double EURGBPB=MarketInfo("EURGBP",MODE_BID);

double EURUSDpoint =MarketInfo("EURUSD",MODE_POINT);//定义相对货币对的点值

double GBPUSDpoint =MarketInfo("GBPUSD",MODE_POINT);//定义相对货币对的点值

double EURGBPpoint =MarketInfo("EURGBP",MODE_POINT);//定义相对货币对的点值

double SHANG= (DoubleToStr( NormalizeDouble((EURUSDA/GBPUSDA),5),5));





if((SHANG-EURGBPA)>=0.002){

OrderSend("EURUSD",OP_SELL,0.01,EURUSDB,10,0,0);

OrderSend("GBPUSD",OP_BUY,0.01,GBPUSDA,10,0,0);

}

if((EURGBPA-SHANG)>=0.002){

OrderSend("EURUSD",OP_BUY,0.01,EURUSDB,10,0,0);

OrderSend("GBPUSD",OP_SELL,0.01,GBPUSDA,10,0,0);

}



if((EURGBPA-SHANG)<=0.0001 ||(SHANG-EURGBPA)<=0.0001){

for(int i=OrdersTotal()-1;i>=0;i--)

{ OrderSelect(i, SELECT_BY_POS);

OrderClose (OrderTicket (), OrderLots (), MarketInfo (OrderSymbol (), MODE_BID), 10000, Red);

}

}

return(0);

}

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