请大家给我看看,这个简单的系统不能编译是什么原因? 新评论 zgrxyuming 2009.04.13 11:38 //+------------------------------------------------------------------+ //| ming.mq4 | //| Copyright ?2009, Ming Software Corp. | //| https://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright ?2009, Ming Software Corp." #property link "https://www.metaquotes.net/" //---- input parameters extern double lot; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { double ma5,ma12; int rs,x=0; lot=NormalizeDouble(AccountFreeMargin()/20000.0,1); if(lot<0.1)lot=0.1; ma5=iMA(Symbol(),0,5,0,MODE_EMA,PRICE_CLOSE,0); ma12=iMA(Symbol(),0,12,0,MODE_EMA,PRICE_CLOSE,0); //---- if( ma5>ma12 ) { x=1; } if(ma5<m12) { x=-1; } for(int i=0;i<OrdersTotal();i++) { rs=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol()==Symbol() { if( x=1) { if (OrderType()==OP_SELL) OrderClose(i,OrderLots(),Ask,3,White); } if (x=-1) { if(OrderType()=OP_BUY) OrderClose(i,OrderLots(),Bid,3,White); } } } if (OrdersTotal()<1) { if(x=1)OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask-20*Point,0,"",16384,0,Red); if(x=-1)OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+20*Point,0,"",16383,0,Green); } // //---- return(0); } //+------------------------------------------------------------------+ [存档!]我将免费撰写任何专家或指标。 请帮我看看这个ea,orderclose执行不了,谢谢! 编码帮助 cyberfox2002 2009.05.09 08:46 #1 错误比较多。都是小问题。 if(ma5<m12) m12在哪里? if( x=1) 应该是==,还有几个地方是这种情况。 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
//+------------------------------------------------------------------+
//| ming.mq4 |
//| Copyright ?2009, Ming Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, Ming Software Corp."
#property link "https://www.metaquotes.net/"
//---- input parameters
extern double lot;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double ma5,ma12;
int rs,x=0;
lot=NormalizeDouble(AccountFreeMargin()/20000.0,1);
if(lot<0.1)lot=0.1;
ma5=iMA(Symbol(),0,5,0,MODE_EMA,PRICE_CLOSE,0);
ma12=iMA(Symbol(),0,12,0,MODE_EMA,PRICE_CLOSE,0);
//----
if( ma5>ma12 )
{
x=1;
}
if(ma5<m12)
{
x=-1;
}
for(int i=0;i<OrdersTotal();i++)
{
rs=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol()==Symbol()
{
if( x=1)
{
if (OrderType()==OP_SELL)
OrderClose(i,OrderLots(),Ask,3,White);
}
if (x=-1)
{
if(OrderType()=OP_BUY)
OrderClose(i,OrderLots(),Bid,3,White);
}
}
}
if (OrdersTotal()<1)
{
if(x=1)OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask-20*Point,0,"",16384,0,Red);
if(x=-1)OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+20*Point,0,"",16383,0,Green);
}
//
//----
return(0);
}
//+------------------------------------------------------------------+