OnBar and OnBarClosed issues when using Renko chart
OnBar and OnBarClosed issues when using Renko chart
17 Jun 2024, 05:12
It appears that these methods are not executing consistently. Screenshot and code below.
protected override void OnBar()
{
var txt = Chart.DrawText(Bars.Count().ToString(), Bars.Count().ToString(), Bars.Last(1).OpenTime, Bars.Last(1).Low - Symbol.PipValue, Color.Black);
txt.HorizontalAlignment = HorizontalAlignment.Center;
txt.VerticalAlignment = VerticalAlignment.Center;
Print($"{Bars.Last(1).OpenTime} ===== {Bars.Count}");
}
Replies
yohtza
18 Jun 2024, 08:34
( Updated at: 18 Jun 2024, 09:04 )
RE: OnBar and OnBarClosed issues when using Renko chart
PanagiotisCharalampous said:
Hi there,
This is by design. If the price jumps more that one bar, then the method is only executed once for the last bar.
Best regards,
Panagiotis
Any suggestions on how to keep the drawing behavior consistent would be greatly appreciated.
Thanks
@yohtza
PanagiotisCharalampous
18 Jun 2024, 09:14
RE: RE: OnBar and OnBarClosed issues when using Renko chart
yohtza said:
PanagiotisCharalampous said:
Hi there,
This is by design. If the price jumps more that one bar, then the method is only executed once for the last bar.
Best regards,
Panagiotis
Any suggestions on how to keep the drawing behavior consistent would be greatly appreciated.
Thanks
On each bar you should keep track how many bars have been added using Bars.Count. If more than one bars have been added then you would need to add the numbers using a loop for all the new bars added
@PanagiotisCharalampous
PanagiotisCharalampous
17 Jun 2024, 05:48
Hi there,
This is by design. If the price jumps more that one bar, then the method is only executed once for the last bar.
Best regards,
Panagiotis
@PanagiotisCharalampous