Support Board
Date/Time: Wed, 22 Jan 2025 13:03:40 +0000
Post From: issue with sc.OpenChartOrGetChartReference
[2018-09-12 06:26:38] |
@sstfrederik - Posts: 405 |
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]; } } |