Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 16:00:25 +0000



Subgraphs blank until I reload

View Count: 998

[2015-01-29 18:30:05]
joshtrader - Posts: 492
Custom study. Code is very simple, really only 1 line, plots the % change. When I change the time frame, the study values disappear, and I have to "reload and recalculate" and they come back. Why is this?

SCSFExport scsf_PercentChangeSinceClose(SCStudyInterfaceRef sc)
{
  if(sc.SetDefaults)
  {
    sc.GraphName="Percent Change Since Close";
    sc.StudyDescription="Calculates the percentage a stock is up or down, based on the prior close.";
    
    sc.AutoLoop = 1;
    sc.GraphRegion = 0;
    sc.FreeDLL = 1;
    
    sc.ValueFormat = 2;

    sc.Subgraph[0].Name = "Percent Change";
    sc.Subgraph[0].PrimaryColor = RGB(100,100,100); // Gray
    sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
    
    return;
  }
    
  sc.Subgraph[0][sc.Index] = ((sc.Close[sc.Index] / sc.PreviousClose) - 1) * 100;
}

Date Time Of Last Edit: 2015-01-29 18:30:25
[2015-01-30 02:14:03]
Sierra Chart Engineering - Posts: 104368
This is because this value sc.PreviousClose is 0 upon a reload of the chart.

You really need to use this function:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scGetOHLCForDate
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-01-30 04:38:10]
joshtrader - Posts: 492
That function is no good because it uses the intraday data which is not the correct closing/settlement value. But I will try to use an external historical chart which should have the closing value of the bar as the settlement -- thank you

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

Login

Login Page - Create Account