OnBarClosed issue
OnBarClosed issue
10 Jan 2025, 16:57
Is it possible that the cTrader.Robot is a kind of asynchronous?
eg. The OnBarClosed
function is called but at the same time the Bars.LastBar
is getting updated and as such it doesn't contain the previous bar closed but it contains the new bar data?
I am having an issue when running my bot via ctrader-cli using a Spotware demo account.
I have something like the following code:
protected override void OnBarClosed()
{
base.OnBarClosed();
var curBarTime = DateToTimezone(Bars.LastBar.OpenTime);
^
|
here we have the issue...
…
blah… blah…
}
When accessing the Bars.LastBar
it seems like sometimes I am getting the new bar values and not the last (closed bar) values. Anyone knows why this might be happening?
When I back test the cBot on my debugger I don't have such behavior. Also, in the provider I have my live funds I haven't observed something like that. But in a Spotware demo account I see such behavior.
Thanks
Efthymios
ekalyvio
22 Jan 2025, 08:51
BUG
Hi, anyone else has such issues? Am I the only one facing them?
Maybe it is related to the Spotware demo account only?
@ekalyvio