如题: 我这个ea是仿照原来的macd simple 来写的 if(Total<1) if((macd1>0 && macd2<macd1 && force<=0 && High[0]>High[1])||(macd1<=0 && macd2<macd1 && force<=0 && High[0]>High[1])) { MyBuyTicket=OrderSend(Symbol(),OP_BUY,lots,Ask,3,0,888,"macd sample",16384,0,Green); if(MyBuyTicket>0) { if(OrderSelect(MyBuyTicket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice()); } else Print("Error opening BUY order : ",GetLastError()); return(0); } if((macd1>0 && macd2>macd1 && force>0 && Low[0]<Low[1]) ||(macd1<=0 && macd2>macd1 && force>0 && Low[0]<Low[1])) { MySellTicket=OrderSend(Symbol(),OP_SELL,lots,Bid,3,0,0,"macd sample",16384,0,Red); if(MySellTicket>0) { if(OrderSelect(MySellTicket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice()); } else Print("Error opening SELL order : ",GetLastError()); return(0); //当含有定单时 kkmacd 的值表示出来的时候是否永远为正数,导致判断macd为负时候出错。 for(n=0;n<Total;n++) { OrderSelect(0, SELECT_BY_POS, MODE_TRADES); //这里用0是因为目前我只打算只做1笔交易,后期如果涉及到分部止盈止损的时候需要用到f o r 循环来选取。 if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { if(Low[0]<Low[1]) { OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position return(0); } } else { if(High[0]>High[1]) { OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position return(0); } } } } } |
请教问题:为何我的EA会连续同一时间不断交易
回复:0 浏览:383
- 楼主admin 圈主
- 2019-05-05 05:52