刚入门的菜鸟。请大神帮忙看段代码!十万火急!
请大神帮我看看我的代码有什么问题,在价格围绕符合开单要求的价格上下波动时,总是不停的开仓平仓,不能正常运转
int onInit()
{
return(INIT_SUCCEEDED);
}
void onDeinit(const int reason)
{
}
void close(string zhushi,int magicnumber)
{
int a=OrdersTotal();
for(int i=a-1;i i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if(OrderComment()==zhushi OrderMagicNumber()==magicnumber)
{
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,Green);
}
}
}
}
void onTimer()//每个价格波动 就执行一次
{
if(High[1] iMA(Symbol(),0,10,0,MODE_SMMA,PRICE_CLOSE,0))
{
sell(0.05,Bid+500*Point,Bid-5000*Point, sell ,2);
}
else if(Low[1] iMA(Symbol(),0,10,0,MODE_SMMA,PRICE_CLOSE,0))
{
close( sell ,2);
}
for(int i=0;i OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
int ti=OrderTicket();
double openprice=OrderOpenPrice();
double stoploss=OrderStopLoss();
double lots=OrderLots();
string zhushi=OrderComment();
int ma=OrderMagicNumber();
int a=9;
}
}
}
int sell(double lots,double stoploss,double takepofit,string comment,int sellmagic)
{
int a=0;
bool zhaodan=false;
for(int i=0;i OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
string zhushi=OrderComment();
int ma=OrderMagicNumber();
if(OrderSymbol()==Symbol() OrderType()==OP_SELL zhushi==comment ma==sellmagic)
{
zhaodan=true;
break;
}
}
}
if(zhaodan==false)
{
OrderSend(Symbol(),OP_SELL,0.05,Bid,10,Bid+500*Point,Bid-5000*Point, sell ,2,0,Red);
}
return(a);
}
int onInit()
{
return(INIT_SUCCEEDED);
}
void onDeinit(const int reason)
{
}
void close(string zhushi,int magicnumber)
{
int a=OrdersTotal();
for(int i=a-1;i i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if(OrderComment()==zhushi OrderMagicNumber()==magicnumber)
{
OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),10,Green);
}
}
}
}
void onTimer()//每个价格波动 就执行一次
{
if(High[1] iMA(Symbol(),0,10,0,MODE_SMMA,PRICE_CLOSE,0))
{
sell(0.05,Bid+500*Point,Bid-5000*Point, sell ,2);
}
else if(Low[1] iMA(Symbol(),0,10,0,MODE_SMMA,PRICE_CLOSE,0))
{
close( sell ,2);
}
for(int i=0;i OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
int ti=OrderTicket();
double openprice=OrderOpenPrice();
double stoploss=OrderStopLoss();
double lots=OrderLots();
string zhushi=OrderComment();
int ma=OrderMagicNumber();
int a=9;
}
}
}
int sell(double lots,double stoploss,double takepofit,string comment,int sellmagic)
{
int a=0;
bool zhaodan=false;
for(int i=0;i OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
string zhushi=OrderComment();
int ma=OrderMagicNumber();
if(OrderSymbol()==Symbol() OrderType()==OP_SELL zhushi==comment ma==sellmagic)
{
zhaodan=true;
break;
}
}
}
if(zhaodan==false)
{
OrderSend(Symbol(),OP_SELL,0.05,Bid,10,Bid+500*Point,Bid-5000*Point, sell ,2,0,Red);
}
return(a);
}
打赏
最新创建圈子
- 新闻EA运行效果图圈 2020-01-01
圈主:admin 帖子:1