Ndumiso Mavuso:
If it was a requote you would get a requote message. It's a bug in your code, the TP is above SL for SELL and below for BUY, should be the reverse.
I see these failed trades with invalid t/p or s/l the code could never have set. I notice these failed trades happen during volatile markets,
I think they are Requotes, are they not?
Alain Verleyen:
If it was a requote you would get a requote message. It's a bug in your code, the TP is above SL for SELL and below for BUY, should be the reverse.
But the code works fine 98% of the time without these error. Are you still confident that its a Bug that happen to come and go?
If it was a requote you would get a requote message. It's a bug in your code, the TP is above SL for SELL and below for BUY, should be the reverse.
This is the code. I do not Modify the Orders after.
extern double Stoploss=4; extern double TakeProfit=20; if(!OrderSend(Symbol(),OP_BUY,lot,NormalizeDouble(MarketInfo(OrderSymbol(),MODE_ASK),Digits),Slippage,NormalizeDouble(MarketInfo(OrderSymbol(),MODE_BID)-StopLoss*UsePoint,Digits),NormalizeDouble(Bid+TakeProfit*UsePoint,Digits),NULL,MagicNumber)) Print("Open Buy Failed",GetLastError()); if(!OrderSend(Symbol(),OP_SELL,lot,NormalizeDouble(MarketInfo(OrderSymbol(),MODE_BID),Digits),Slippage,NormalizeDouble(MarketInfo(OrderSymbol(),MODE_ASK)+StopLoss*UsePoint,Digits),NormalizeDouble(Ask-TakeProfit*UsePoint,Digits),NULL,MagicNumber)) Print("Open Sell Failed",GetLastError());
Ndumiso Mavuso:
But the code works fine 98% of the time without these error. Are you still confident that its a Bug that happen to come and go?
But the code works fine 98% of the time without these error. Are you still confident that its a Bug that happen to come and go?
Of course it's a bug. Working 98% is irrelevant, a bug doesn't have to occur all the time.
The snippet of code you posted is not enough to figure out the issue.
Alain Verleyen:
But its a simple code, this is the snippet that send orders nonthing else interferes with them.Of course it's a bug. Working 98% is irrelevant, a bug doesn't have to occur all the time.
The snippet of code you posted is not enough to figure out the issue.
The other thing is that I do not get the "Open Buy Failed" Print, why is that?
Yes it was a Bug. Had to replace Ask/Bid with:
MarketInfo(OrderSymbol(),MODE_ASK) MarketInfo(OrderSymbol(),MODE_BID)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I see these failed trades with invalid t/p or s/l the code could never have set. I notice these failed trades happen during volatile markets,
I think they are Requotes, are they not?