Download MetaTrader 5

Is it a Requote?

To add comments, please log in or register
Download MetaTrader 5 for iPad and trade anywhere!
Ndumiso Mavuso
4375
Ndumiso Mavuso 2016.02.27 17:57 

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
Moderator
30745
Alain Verleyen 2016.02.27 17:58  
Ndumiso Mavuso:

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?


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.
Ndumiso Mavuso
4375
Ndumiso Mavuso 2016.02.27 18:08  
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?
Ndumiso Mavuso
4375
Ndumiso Mavuso 2016.02.27 18:16  

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()); 
Alain Verleyen
Moderator
30745
Alain Verleyen 2016.02.27 18:36  
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?

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.

Ndumiso Mavuso
4375
Ndumiso Mavuso 2016.02.27 20:42  
Alain Verleyen:

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.

But its a simple code, this is the snippet that send orders nonthing else interferes with them.

The other thing is that I do not get the "Open Buy Failed" Print, why is that?
Ndumiso Mavuso
4375
Ndumiso Mavuso 2016.02.29 19:26  
Yes it was a Bug. Had to replace Ask/Bid with:
MarketInfo(OrderSymbol(),MODE_ASK)

MarketInfo(OrderSymbol(),MODE_BID)
To add comments, please log in or register