EA bot not activating sell stop in time


Hi everyone,

So i've been working on this EA for some time. However today while testing it on a live chart I noticed an issue where my EA wouldn't activate the sell stop in time.

[Image 1]

Notice in image1 that the sellstop was roughly around 1.33060 however looking at [Image 2]

you'll notice that the deal was done at 1.32899 which was way off from the first one. 

How i have the trades being sent is shown below:

     double candlePrice = iOpen(_Symbol,PERIOD_M15,0);

where the candle price would be the opening price of the candle.

So im just wondering if anyone has ever encountered this issue and if so if they have any tips on to solve this. Or if anyone has any tips on debugging this issue? 

Thank you :) 

Image1.PNG  1553 kb
Image2.PNG  9 kb