Hi, this is the first post I create on the forum and I'd like to start by thanking you for the help you've been providing; I've used this forum countless times and it's been almost always useful.
That being said, the problem I need help with is the following. I am backtesting an EA that places a pending order at, say, 1.05834. The order is placed successfully and I can see that in the graphic. However, the backtester opens the order before actually reaching that price, 1.05834. In this case, the High of the bar that opens the pending order is 1.05833, so I don't understand how it's able to open it. I don't really know how to approach this bug, I don't even know if it's a bug or this is how the backtester works (although it doesn't make much sense to me). I am currently using a spread of 2, I don't know if this info is necessary. I hope some of you can help me out here, I'd really appreciate it. Thanks!
You buy at the Ask and sell at the Bid.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger at a specific Bid price, add the average spread. MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.) Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
Thanks a lot for the answer and the additional explanation about brokers' practices. Solved!