Login Page - Create Account

Support Board


Date/Time: Mon, 23 Mar 2026 23:24:43 +0000



[Programming Help] - [ACSIL] Got stuck on this seemingly basic issue, need help

View Count: 30

[2026-03-23 17:35:49]
Tony - Posts: 697
I tried to write an ACSIL code to center the chart:

void CenterTheChart(SCStudyInterfaceRef sc)
{
  sc.BaseGraphScaleRangeTop = sc.Close[sc.IndexOfLastVisibleBar] + sc.BaseGraphScaleConstRange/2.0;
  sc.BaseGraphScaleRangeBottom = sc.Close[sc.IndexOfLastVisibleBar] - sc.BaseGraphScaleConstRange/2.0;
}

But it always put the candle bars way too low (bottom 1/3 of screen)
Until I did this to put the chart in the center of the chart window:

void CenterTheChart(SCStudyInterfaceRef sc)
{
  sc.BaseGraphScaleRangeTop = sc.Close[sc.IndexOfLastVisibleBar] + sc.BaseGraphScaleConstRange*1/7.0;
  sc.BaseGraphScaleRangeBottom = sc.Close[sc.IndexOfLastVisibleBar] - sc.BaseGraphScaleConstRange*6/7.0;
}

It's really embarrassing that I couldn't figure out what was going on, any help would be appreciated.
Date Time Of Last Edit: 2026-03-23 17:36:49

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

Login

Login Page - Create Account