Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 17:19:27 +0000



Post From: OpenChartOrGetChartReference() DaysToLoad incorrect

[2022-04-13 14:05:51]
User660727 - Posts: 50
Sierra Chart version 2383

The DaysToLoad value passed to OpenChartOrGetChartReference() is not being correctly set.
In the example below, setting the value to 15 results in an actual value of 45.
Set the attached screenshot for the actual result of running this example.


#include <sierrachart.h>

SCDLLName("SCTest");
int dcNum {};

void CrupdateDataChart(SCStudyGraphRef sc) {
  s_ACSOpenChartParameters cfg;
  cfg.PriorChartNumber = dcNum;
  cfg.Symbol = sc.GetRealTimeSymbol();
  cfg.ChartDataType = INTRADAY_DATA;
  cfg.IntradayBarPeriodType = IBPT_DAYS_MINS_SECS;
  cfg.IntradayBarPeriodLength = 1;
  cfg.DaysToLoad = 15;
  cfg.SessionStartTime.SetTime(sc.StartTime1);
  cfg.SessionEndTime.SetTime(sc.EndTime1);
  cfg.EveningSessionStartTime.SetTime(sc.StartTime2);
  cfg.EveningSessionEndTime.SetTime(sc.EndTime2);
  cfg.LoadWeekendData = 1;
  cfg.UseEveningSession = 1;
  cfg.HideNewChart = 1;
  cfg.UpdatePriorChartNumberParametersToMatch = 1;
cfg.ContinuousFuturesContractOption = sc.ContinuousFuturesContractOption!=CFCO_NONE ?sc.ContinuousFuturesContractOption :CFCO_DATE_RULE_ROLLOVER;

  dcNum = sc.OpenChartOrGetChartReference(cfg);
}

SCSFExport scsf_SCTest(SCStudyGraphRef sc) {
if (sc.SetDefaults) {
sc.AutoLoop = 0;
return;
}
if (sc.LastCallToFunction) { return; }
if( sc.UpdateStartIndex==0 && sc.IsFullRecalculation )
CrupdateDataChart(sc);

}

imagedaystoload.png / V - Attached On 2022-04-13 14:05:13 UTC - Size: 82.73 KB - 122 views