Login Page - Create Account

Support Board


Date/Time: Thu, 16 May 2024 03:18:31 +0000



Post From: Subgraphs blank until I reload

[2015-01-29 18:30:05]
joshtrader - Posts: 442
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