The EA will compile OK, but that alone doesn't mean that it won't produce errors. These lines are from the EA when it sends your buy orders:
Neither the stop-loss nor the take profit is being normalised before the order is being sent. The same applies to your sell orders. Similarly, you should check that the SL/TP values are not tighter than the minimum allowed by your broker and adjust them if this is the case.Code:if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0; if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0; //Normalise your SL & TP in these lines and adjust for broker's minimum order distance before sending the order Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
I can also see that the lot sizes are not being normalized either before the orders are being sent. This is something else that you should think about implementing in future even if it isn't the cause of your current problem.
Please search some of the posts on the MQL4 forum which explain some of the common problems involved with sending orders.



Reply With Quote
