Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 05:11:28 +0000



issue with sc.OpenChartOrGetChartReference

View Count: 674

[2018-09-12 06:26:38]
@sstfrederik - Posts: 403
Hi,

There seems to be an issue when sc.OpenChartOrGetChartReference and setting LoadWeekendData to 0. It keeps opening charts.

I took the example code below and only added the LoadWeekendData setting and it also has this issue.

Is there anything I am missing?

Thanks

Frederik

SCSFExport scsf_OpenChartOrGetChartReferenceExample(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Output = sc.Subgraph[0];
  
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    
    sc.GraphName = "OpenChartOrGetChartReference Example";
    
    sc.StudyDescription = "This study demonstrates using the OpenChartOrGetChartReference function. This study does not calculate anything.";
    
    sc.AutoLoop = 0;//Manual looping
    
    // During development set this flag to 1, so the DLL can be modified. When development is done, set it to 0 to improve performance.
    sc.FreeDLL = 1;
    
    Output.Name = "Output";
    Output.DrawStyle = DRAWSTYLE_LINE;
    Output.PrimaryColor = RGB(0,255,0);
    
    return;
  }
  
  
  // Do data processing
  
  // Remember the chart number in a persistent variable to make the chart
  // lookup more efficient.
  int& ChartNumber = sc.GetPersistentInt(1);

  //Only do this on a full recalculation. Could also use sc.UpdateStartIndex == 0 in the case of manual looping which we are using.
  if ( sc.IsFullRecalculation)
  {

    s_ACSOpenChartParameters OpenChartParameters;
    OpenChartParameters.PriorChartNumber = ChartNumber;
    OpenChartParameters.ChartDataType = INTRADAY_DATA; //This can also be set to: DAILY_DATA
    OpenChartParameters.Symbol = sc.GetRealTimeSymbol();//When want to use the symbol of the chart the study function is on, use sc.GetRealTimeSymbol()
    OpenChartParameters.IntradayBarPeriodType = IBPT_DAYS_MINS_SECS;
    OpenChartParameters.IntradayBarPeriodLength = 30*SECONDS_PER_MINUTE; // 30 minutes
    OpenChartParameters.DaysToLoad = 0;//same as calling chart
    // These are optional
    OpenChartParameters.SessionStartTime.SetTimeHMS(12, 0, 0);
    OpenChartParameters.SessionEndTime.SetTimeHMS(23,59,59);
    //OpenChartParameters.EveningSessionStartTime.SetTimeHMS(0,0,0);
    //OpenChartParameters.EveningSessionEndTime.SetTimeHMS(23,59,59);
    //This is added to not load weekend data, but gives problems
OpenChartParameters.LoadWeekendData = 0;

    ChartNumber = sc.OpenChartOrGetChartReference(OpenChartParameters);

  }

  if (ChartNumber != 0)
  {
    SCGraphData ReferenceChartData;
    
    // Get the arrays from the reference chart
    sc.GetChartBaseData(ChartNumber, ReferenceChartData);
    if (ReferenceChartData[SC_LAST].GetArraySize() == 0)
      return; // The array is empty
    
    // Copy the reference chart array Last values to Subgraph 0.
    // Most likely the array from the reference chart is not
    // the same size as the array this study function is applied to.
    // Therefore, there is not going to be a correct column to column
    // correspondence. However, this is just a simple example.
    Output[sc.Index] = ReferenceChartData[SC_LAST][sc.Index];
  }

}

[2018-09-12 06:48:18]
@sstfrederik - Posts: 403
looks like the chart that are loaded still have weekend data set to yes. When I manually change the chart settings of one of the open charts to not load weekend data, the opening of new charts stops.
[2018-09-13 18:57:11]
Sierra Chart Engineering - Posts: 104368
We will check on this.
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
[2018-09-19 18:13:21]
@sstfrederik - Posts: 403
Any news on this? Thanks.
[2018-09-19 19:04:20]
Sierra Chart Engineering - Posts: 104368
Yes this has already been resolved.
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

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

Login

Login Page - Create Account