Download MetaTrader 5

Backtesting long entry price outside candle

To add comments, please log in or register
Ian Harris
106
Ian Harris  

All,

Apologies if this question is in the wrong area, happy to move it if you want me to.

Ran my first backtest today having finally completed my first EA. I ran it in visualisation mode and sat fascinated as I watched it take trades, quite a lot or them winners! Then I noticed something odd. On quite a few trades, the trade price was higher than the high of the bar it occurred on. Have a look at the screen shot. These are both shots of the same exit. Note the price is 1.30716 (or 1.30714, not sure why there are two prices there), but the high of the bar was 1.30700. There were quite a few examples of this. The sell transactions, on the other hand, were all spot on. I've double checked the code, and then checked again. The code for both buy and sell signals looks exactly identical to me (but opposite of course). Can anybody point me in the direction of an explanation why this is happening, and what, if anything, I can do about it?

Thanks, Ian

Files:
Ernie Gunning
1147
Ernie Gunning  

Wow you're like flying high there. Your EA is so good bru it tweaks the market in your favor AWESOME! :)

on a serious note I think you need to clear the download cach in your Tester directory are restart. If this continues I suggest connecting to a diffrent server for feeds.

Are you only testing using your PC or are you using other CPUs on the network or cloud?

 

Andriy Moraru
1260
Andriy Moraru  
The answer is pretty simple - the chart bars are plotted according to Bid price. So, the actual price for Long positions can be +Spread higher.
Ian Harris
106
Ian Harris  

ToolMaker, I wish! I think enivid is right though. It seems all sell transactions are shown inside the bar, as they are executed at the bid price, but the buy transactions are higher as they are executed at the ask price. I'm still trying to wrap my brain around forex trading, and still making some basic mistakes. (but that's good, right? that means I'm trying and learning!) I've been trading e-mini futures for a while, and there is no spread, but there is commission. Swings and roundabouts really. Personally I'd rather pay commission and be in profit if the market moves one pip in my favour, rather than have to deal with spreads, but that's just me.

Thanks for enlightening me enivid, you've done it a couple of times now! Much appreciated.

;-) Ian


To add comments, please log in or register