Need help on Error 138

 

I am using version 4.0 Build 419.

I found an error 138 in my EA backtest in the strategy tester and then I tried to simplify the code to see what was wrong. But finally, it was simplifed to the following code.

int start()
{
OrderSend(Symbol(),OP_BUY,0.1,Bid,10,0,0," ",0,0,Blue);
return(0);
}

I tried using different time frames and different pairs, but nothing worked.

Please help me.

 
You cannot Buy at Bid . . . it's the wrong price, hence . . . from the Documentation ( did you read it ? ) . . . . "The requested price has become out of date or bid and ask prices have been mixed up. "
 
RaptorUK:
You cannot Buy at Bid . . . it's the wrong price, ...
Meaning that you should be Buying at Ask :-)
 
  1. Must buy at the Ask.
  2. Using a 1 pip slippage on a 5 digit broker. (Adjust for 4/5 digit brokers)
  3. Not checking return codes
 
WHRoeder:
  1. Must buy at the Ask.
  2. Using a 1 pip slippage on a 5 digit broker. (Adjust for 4/5 digit brokers)
  3. Not checking return codes

Thank you. I cannot believe I made such a stupid mistake.