申请修改EA
有一网格EA,当设置了平价保护后,有持仓单被止损后,程序会重新挂单。但发现按程度的方式挂单会导致爆仓。请版主帮忙修改。我的想法是,程序所有的追加挂单,都要满足价格的条件。也就是,当追加BUY STOP单时,要求只在挂单价格高于所有未成交多单的最高价时,才挂单;当追加SELL STOP单时,要求只在挂单价格低于所有未成交空单的最低价时,才挂单。谢谢 以下是EA源码: //+------------------------------------------------------------------+ //| hedge.mq4 | //+------------------------------------------------------------------+ extern double Lots=0.10; extern bool Use_TrailingStop=false; extern int TrailingStop=15; extern bool Use_BreakEven=true; extern int BreakEvenPoint=42; extern int BreakEven_Move_Stop_To=0; extern bool Use_StopLoss=false; extern int SL=50; extern bool Use_TakeProfit=false; extern int TP=200; extern int BuyStep=50; extern int SellStep=50; extern int BuyOrderNumber=4; extern int SellOrderNumber=4; extern int BuyBegin=0; extern int SellBegin=50; extern int MinDistance=4; extern bool houseclean=true; extern double Equity_Percent=1; extern int Magic_Number=3456; extern int Slippage=3; string com="hedge"; int init(){return(0);} int deinit(){return(0);} int start() { Comment(" BuyStop orders: "+TotalOrdersMode(Magic_Number,OP_BUYSTOP)+"n SellStop orders: "+TotalOrdersMode(Magic_Number,OP_SELLSTOP)+"n Sell orders: "+TotalOrdersMode(Magic_Number,OP_SELL)+"n Buy orders: "+TotalOrdersMode(Magic_Number,OP_BUY)); double s=0; double SL1=0;double TP1=0; int i=0,j=0,r=-1; bool g=false; int k=0; if (TotalOrders(Magic_Number)==0){ s=next(OP_BUYSTOP,Ask,BuyBegin,MinDistance,BuyStep,Digits); for (j=0;j |
打赏
最新创建圈子
- 新闻EA运行效果图圈 2019-05-05
圈主:admin 帖子:1