Topics
Replies
eofe
21 Feb 2020, 12:21
RE:
srubtsov said:
Use the exact time to get today's bar is not so good way, because a bar can be not created yet, bar creates exactly after the first tick in the bar. So the best way here to use BarOpened event.
protected override void OnStart() { Bars eurgbpDailyBars = MarketData.GetBars(TimeFrame.Daily, "EURGBP"); eurgbpDailyBars.BarOpened += OnEurgbpDailyBarOpened; } private void OnEurgbpDailyBarOpened(BarOpenedEventArgs args) { Print("HighPrices.Last(1): " + args.Bars.HighPrices.Last(1)); }
Will explore your suggestion, thank you.
@eofe
eofe
21 Feb 2020, 11:35
After further testing, I realised the problem was usually caused during the first multi symbol variable initiation. I updated the code to initialise bars in onstart instead of onbar and it seems to fix the problem. Will monitor next week.
Is there a difference in how ctrader initialise bars vs marketseries? Maybe one is Async while the other one is not?
Or maybe the proxy lag from 2ms to 80ms could have caused it.
@eofe
eofe
06 Dec 2019, 09:34
RE:
PanagiotisCharalampous said:
Hi eofe,
Christmas was the target for the Beta :) We cannot give an ETA for release to brokers, it depends on how the Beta testing will go. We will release to brokers as soon as we are confident that 3.7 is stable enough for production environments.
Best Regards,
Panagiotis
Noted Panagiotis. Please don’t make the cTrader fans wait too long!
@eofe
eofe
06 Dec 2019, 09:20
RE:
PanagiotisCharalampous said:
Hi eofe,
The bar's open time is taken from the first new tick that will arrive for that bar. This is why you get different opening times.
Regarding sample, I am not sure what do you need exactly but below you can see a very simple example of listening to the BarOpened event
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class BarOpenedExample : Robot { protected override void OnStart() { var bars = MarketData.GetBars(TimeFrame.Minute, "GBPUSD"); bars.BarOpened += Bars_BarOpened; } private void Bars_BarOpened(BarOpenedEventArgs obj) { Print("New bar created for " + obj.Bars.SymbolName + " at " + obj.Bars.Last(0).OpenTime); } } }
Best Regards,
Panagiotis
that will do fine, Panagiotis. Many thanks.
can we expect 3.7 to be pushed out to brokers by Xmas as you have mentioned in your earlier posts?
@eofe
eofe
30 Apr 2020, 13:42
RE:
eofe said:
Strangely this problem does not affect demo account. It affects Live accounts.
cTrader support did you manage to replicate this bug?
@eofe