Not getting ask price on position opened from pending order

 

Hello guys,

 

As we know the prices information on the Data Window of Strategy Tester Visualization are "BID prices".We also know that when we open a long position, we buy at the Ask Price.

I am using only pending orders on the EA, but when they get triggered I am not seeing the Ask price beeing used to opeining the position...Let's see:

 

double price_in = candle[1].high // high price form the previous candle

// When RSI indicator meets a certain condition, the EA sends a pending order to get triggered when price reaches the previous candle high.

 

request.action = TRADE_ACTION_PENDING; 

 request.type  = ORDER_TYPE_BUY_STOP;

request.price = price_in

 

Example:

candle[1].high = 1.30838

I have obtained the info of Bid and Ask Price (using SymbolInfoDouble funcion) when the position is opened but the Ask Price is different than 1.30838:

Ask = 1.30806

Bid = 1.30794

The price recorded is acctually the high price of the previous candle when the order was launched:

But shouldn't this price and the Ask price be the same? Actually doesn't match neither the Bid price...

  What am I not seeing on this??? Please help.

 Thanks,

Filipe

 
filipe197: But shouldn't this price and the Ask price be the same? Actually doesn't match neither the Bid price...  What am I not seeing on this??? 

When the Ask reaches or exceeds your pending price, the order becomes a market order and opens at any available price.

 
William Roeder:

When the Ask reaches or exceeds your pending price, the order becomes a market order and opens at any available price.

But the problem is that the ask price did not exceed the pending price. The pending price was defined as 1.30838 and when the pending order got triggered and open the position, the ask price is 1.30806 which is below the open price defined...
 
filipe197: But the problem is that the ask price did not exceed the pending price. The pending price was defined as 1.30838 and when the pending order got triggered and open the position, the ask price is 1.30806 which is below the open price defined...

Did you check the prices of the previous ticks?

 
Fernando Carreiro:

Did you check the prices of the previous ticks?

I found out what I was seeing wrong... I was looking at the bid/ask price of the order opening  and not of the position opening. Now its clear and makes sense!

Thanks guys!

Reason: