Different backtesting results with 1m bars from server (open prices) when using OnTick() and OnBar()

Created at 22 Jun 2020, 16:05
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!
TI

timo.kolthoff

Joined 09.05.2020

Different backtesting results with 1m bars from server (open prices) when using OnTick() and OnBar()
22 Jun 2020, 16:05


So when running a piece of code, I speed up the testing by using 1m bars from server. When using OnTick() for this test I get a result which differs from the result if I change the OnTick() to OnBar() method instead. The code is the same as well as the 1m bars!

So my question is what don't I understand, the OnTick() and OnBar() should give the same result when using the 1m bars from the server, or?

BR


@timo.kolthoff
Replies

PanagiotisCharalampous
22 Jun 2020, 16:09

Hi Timo,

Which timeframe do you use for backtesting? Can you share your code so that we can reproduce what you see?

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

timo.kolthoff
22 Jun 2020, 16:30

RE:

PanagiotisCharalampous said:

Hi Timo,

Which timeframe do you use for backtesting? Can you share your code so that we can reproduce what you see?

Best Regards,

Panagiotis 

Join us on Telegram

 

Hi,

You can test this with "Sample RSI cBot", just default settings, 1h TimeFrame and 1m bars from server, 1 month of testing. Changing OnTick() to OnBar() gives different results!

BR


@timo.kolthoff

PanagiotisCharalampous
22 Jun 2020, 16:32

Hi Timo,

If you are backtesting on the hourly timeframe then of course it will. OnBar() is triggered on every hour and OnTick() on every minute.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

timo.kolthoff
22 Jun 2020, 16:36

RE:

PanagiotisCharalampous said:

Hi Timo,

If you are backtesting on the hourly timeframe then of course it will. OnBar() is triggered on every hour and OnTick() on every minute.

Best Regards,

Panagiotis 

Join us on Telegram

Thanks for pointing out the obvious, case closed!


@timo.kolthoff