Strategy tester - EA not buying on open prices

 

Hi guys,

I'm testing some EAs on strategy tester with stock data and I noticed that whenever the EA buys, it closes the deal at a price 1 cent above the open price of the bar, as I'm running it on open prices only. This does not happen when it sells, as the price of the deal is exactly the open price. I tried running on every tick and the result is the same, EA is always buying at a price 1 cent above the open price of the bar. This error is more evident when working with M1 period, as the EA buys at a price that is higher than high price of the bar, which makes no sense.

I'm using the CTrade class, checked the code, and it seems fine. I tried other EAs and it still gives me buy deals on wrong prices. Does anyone know how to solve it?

Thanks! 

 
cat0l0n:

Hi guys,

I'm testing some EAs on strategy tester with stock data and I noticed that whenever the EA buys, it closes the deal at a price 1 cent above the open price of the bar, as I'm running it on open prices only. This does not happen when it sells, as the price of the deal is exactly the open price. I tried running on every tick and the result is the same, EA is always buying at a price 1 cent above the open price of the bar. This error is more evident when working with M1 period, as the EA buys at a price that is higher than high price of the bar, which makes no sense.

I'm using the CTrade class, checked the code, and it seems fine. I tried other EAs and it still gives me buy deals on wrong prices. Does anyone know how to solve it?

Thanks! 

A SELL is open at bid price and close at ask price. A BUY is open at ask price and close at bid price. All MT4/MT5 charts are build on bid prices.

 
Alain Verleyen:

A SELL is open at bid price and close at ask price. A BUY is open at ask price and close at bid price. All MT4/MT5 charts are build on bid prices.

Thanks for your reply!

I think it makes sense now. 

Reason: