Login Page - Create Account

Support Board


Date/Time: Thu, 27 Feb 2025 06:06:38 +0000



[Programming Help] - Accessing last visible bar on chart

View Count: 1004

[2021-06-23 05:52:43]
skellington - Posts: 14
Hi,

I'm trying to update a string using drawing tools to show the value of an indicator for the last bar on the current chart. It's similar to how studies show their values for the last bar as you scroll left and right.

I don't want subgraph.Data[sc.Index] (for example), because it always gives me the last bar of data, not the last bar that's current visible in the chart.

Thanks!
[2021-06-23 06:43:02]
User907968 - Posts: 833
ACSIL Interface Members - Variables and Arrays: sc.IndexOfLastVisibleBar

Also see -
ACSIL Interface Members - Introduction
ACSIL Interface Members - Variables and Arrays

Ctrl + F is your friend
[2021-06-23 17:48:41]
skellington - Posts: 14
Is there any way to get this dynamically when the user scrolls without setting sc.UpdateAlways to 1?

When I do set UpdateAlways = 1, I get the changing value but there is a noticeable delay between scrolling and the value update which I draw as text into the chart. I guess the delay is caused by the 200ms update rate when no new chart data is added.

It's not a big deal, but I'm curious how the region study bars seem to update their values perfectly in sync with scrolling, or if I can piggy back onto that system somehow.

Also, not sure that I want to update the study continuously just to handle when the chart scrolls. I guess I can add some early out logic if the IndexOfLastVisibleBar doesn't change.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account