资源描述:
《锁仓顺势加码EA源码(MT4自动交易系统实例三)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、MT4自动交易系统实例三锁仓顺势加码EA源码#propertycopyright""#propertylink ""#includeexternboolUSE_ATR=true;externintPercentATR=40;//40%ATRexterndoubleHedgingLevel=30;externboolAutoTakeProfit=false;intstart() {Hedge_Assistante(); return(0); }//+--------------------
2、----------------------------------------------+voidHedge_Assistante(){inti,Tic,Ticket,Hedge,Type;doubleTP;stringmsg=""+"ATR(14)="+iATR(Symbol(),PERIOD_D1,14,0)+""+"dHigh:"+iHigh(Symbol(),PERIOD_D1,0)+" dLow:"+ iLow(Symbol(),PERIOD_D1,0)+""+"AtrHi:"+(iL
3、ow(Symbol(),PERIOD_D1,0)+iATR(Symbol(),PERIOD_D1,14,0))+ " AtrLo:"+(iHigh(Symbol(),PERIOD_D1,0)-iATR(Symbol(),PERIOD_D1,14,0));Comment(msg,Red,10);//1)仅对于BUY/SELL手动订单进行止盈,BUY/SELLSTOP和BUY/SELLLIMIT的手动订单不会进行止盈//2)GBP/USD止盈17点,其他货币对止盈10点if(AutoTakeProfit) {f
4、or(i=0;i5、fitis10 if(OrderType()==OP_BUY) { if(Bid-OrderOpenPrice()>=TP*Point) { if(OrderClose(OrderTicket(),OrderLots(),Bid,2,0)==true) {Alert("GoodJob!自动止盈@",Bid," ",OrderTicket()," ",OrderTakeProfit(),"-",OrderOp
6、enPrice(), "=",OrderTakeProfit()-OrderOpenPrice(),"X",OrderLots(),"=",OrderProfit()); return(0); } elseAlert(OrderTicket(),"CloseOrdererr---->",ErrorDescription(GetLastError())); }
7、 if(OrderTakeProfit()-OrderOpenPrice()<(TP-1)*Point
8、
9、OrderTakeProfit()-OrderOpenPrice()>(TP+1)*Point) { if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()+TP*Point,0,0)==true) {Alert(Order
10、Ticket()," ",Symbol()," Buy=",OrderOpenPrice()," 设置止盈@",OrderOpenPrice()+TP*Point); Sleep(10000); } el