OnBar() or OnBarClosed() for backtesting

Created at 25 Oct 2024, 07:53
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!
nyegin's avatar

nyegin

Joined 02.05.2024

OnBar() or OnBarClosed() for backtesting
25 Oct 2024, 07:53


Hi there;

In the bot I wrote; If I use OnBarClosed() instead of OnBar() and close the preview while doing a backtest, the bot gives an error and does not test. The log record says: "01/01/2024 23:01:00.673 | Error | CBot instance [CBot, XAUUSD, m1] crashed with error #ED2F94F3.

I cannot optimize it in the same way. If I write OnBar(), there is no problem. However; I want to use OnBarClosed() to be consistent. How can I solve this problem?

Thanks


@nyegin
Replies

PanagiotisCharalampous
25 Oct 2024, 11:52

Hi there,

Please share your cBot code let us know your broker and which version of cTrader you use so that we can reproduce this issue.

Best regards,

Panagiotis


@PanagiotisCharalampous