Positions open and close in weird places

Created at 20 Oct 2019, 12:22
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
douglascvas's avatar

douglascvas

Joined 02.01.2018

Positions open and close in weird places
20 Oct 2019, 12:22


I've written an Indicator and a Robot that try doing the same thing.

The indicator simulates a trading session as if it was a robot, so I can see easily in the screen what would be the result, where is each trade, where each StopOrder would be set, be cancelled, or where the positions would open and close, and the profit generated in the end.

I then use the same algorithm in the robot so to apply in real life. 

The problem is that the results in the robot are totally different from the indicator.

Analysing further the trades generated by the robot, I can see that many orders are opened way above the high of a candle (how is that even possible?), many positions are closed way below the stop losses, pending orders are filled in positions different than the target.

Look the red lines (generated by ctrader on a loss) in the picture below, the position was opened where there wasn't even candle.

 

The stop loss was in the level of the orange line at 06:10, more or less on 21550.00, but the position was only closed way below it, near 21510.00.


@douglascvas
Replies

PanagiotisCharalampous
21 Oct 2019, 09:12

Hi douglascvas,

To give you an explanation we will need the source code for both the cBot and the Indicator. However, the most common explanation for such cases is that the candles are drawn based on the Bid prices but buy positions are opened based on the Ask prices. Therefore if the spread is high then sometimes the positions might open on places outside of the candle.

Best Regards,

Panagiotis


@PanagiotisCharalampous