I have alerts that display details of an executed trade once the trade line has been executed. Problem is, the alerts display but the trade is not executed. So the criteria for the trade is met an and the trade is not executed but the alert line is. This EA has worked in the past and the trade lines have not changed since so the trade lines are legit. What could be the problem?
Perhaps you should test the return values from your OrderSend() calls and if they have failed you can find what the error was and print all the relevant information to the log. Then when it fails you will have all thee necessary information to determine the cause of the failure . . .
Read this: What are Function return values ? How do I use them ?
- Just because it worked previously and you didn't change them doesn't mean there were no problems with the code. It means you didn't see any before. Never assume.
iTicket = OrderSend(Symbol(), ... if (iTicket > 0) ...
Check your return codes (OrderSend, OrderModify) What are Function return values ? How do I use them ? - MQL4 forum So you find out WHY they've stopped working.- Add print statements so you find out if you are even TRYING to open.
Print("Bid=",PriceToStr(Bid)," High[",h,"]=",PriceToStr(High[h])," B>H==" Bid >= High[h] + 1*Point); if(Bid >= High[h] + 1*Point) ..
string PriceToStr(double p){ return( DoubleToStr(p, Digits) ); }
Perhaps you should test the return values from your OrderSend() calls and if they have failed you can find what the error was and print all the relevant information to the log. Then when it fails you will have all thee necessary information to determine the cause of the failure . . .
Read this: What are Function return values ? How do I use them ?
But there would be no return code because the line does not execute...That is the problem. It's not a failed entry, it's like the OrderSend(Symbol(). OP_BUY etc line isn't even there....
And if the line was executed and there was a return code you want to ignore it ?
What do you have in the log ? is Allow Live Trading enabled ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have alerts that display details of an executed trade once the trade line has been executed. Problem is, the alerts display but the trade is not executed. So the criteria for the trade is met an and the trade is not executed but the alert line is. This EA has worked in the past and the trade lines have not changed since so the trade lines are legit. What could be the problem?