Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 22:37:05 +0000



Data Error using GetHighest with multiple timeframes

View Count: 1325

[2014-06-25 00:25:45]
Joe Hobart - Posts: 89
When i try to use highest or gethighest on scgraphdata from another chart, i am getting undefined results. In the below code sg0 will return -320000000000000000000000 and sg1 will return the expected result of the daily high. Can you give me a tip on how i can use a helper function to calculate gethighest in an autoloop? I have to calculate the highest price on multiple timeframes (D,Wk,Mo,Yr) so i was hoping to avoid autoloop self calculated shenanigans. If it matters I am using a 5m intraday to host the code and the 1d intraday as defined in the snippet


SCGraphData DailyBars;
  s_ACSOpenChartParameters OpenChartParameters;
  OpenChartParameters.PriorChartNumber = 0;
  OpenChartParameters.ChartDataType = INTRADAY_DATA;
  OpenChartParameters.Symbol = sc.GetRealTimeSymbol();
  OpenChartParameters.IntradayBarPeriodType = IBPT_DAYS_MINS_SECS;
  OpenChartParameters.IntradayBarPeriodLength = 86400 ; // 1 day
  OpenChartParameters.DaysToLoad = 60;
  OpenChartParameters.SessionStartTime.SetTimeHMS(0,0,0);
  OpenChartParameters.SessionEndTime.SetTimeHMS(23,59,59);
  sc.PersistVars->i10 = sc.OpenChartOrGetChartReference(OpenChartParameters);
  sc.GetChartBaseData(sc.PersistVars->i10, DailyBars);

  int DRefChartIndex = sc.GetNearestMatchForDateTimeIndex(sc.PersistVars->i10,sc.Index);
  
  sc.Subgraph[0][sc.Index]=sc.GetHighest(DailyBars[SC_HIGH],3);
  sc.Subgraph[1][sc.Index]=DailyBars[SC_HIGH][DRefChartIndex];

[2014-06-25 11:17:44]
Joe Hobart - Posts: 89
I have worked around the problem using a daily chart and some GetOHLCOfTimePeriod / GetStartOfPeriodForDateTime gymnastics. If you have any other ideas, im open to it. im satisfied with this workaround, especially since i come to find the programmatic charts only allow daily bars, i have to hand calculate the intervals anyways.

[2014-06-26 06:58:56]
Sierra Chart Engineering - Posts: 104368
Refer to the documentation in this section here about this:
http://www.sierrachart.com/index.php?l=doc/doc_ACSILRefOtherTimeFrames.php#DirectReferencing

The documentation explains how to do what you want to do. And it also explains that it is not possible to get the base data arrays from another chart and then call functions like sc.GetHighest on one of those arrays.

especially since i come to find the programmatic charts only allow daily bars
This is definitely not the case. You can use any timeframe.
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
Date Time Of Last Edit: 2014-06-26 06:59:52
[2014-06-26 09:44:19]
Joe Hobart - Posts: 89
when i use OpenChartOrGetChartReference, i only have the option of DAILY and INTRADAY data bars. There is IntradayBarPeriodType for setting intraday bars, but I was not able to locate documentation on how to load a historical weekly/quarterly/yearly bar chart programmatically. How do i specify quarterly bars for a programmatically opened chart? I know i could do (365/4) day intraday chart, but i want the integrity of the historical server to ensure correct dates. My hope was to be able to programmatically open a weekly or quarterly bar chart for reference from an intraday chart, such as drawing the last quarterly high.


enum ChartDataTypeEnum
{ NO_DATA_TYPE = 0
, DAILY_DATA = 1
, INTRADAY_DATA = 2
};

OpenChartParameters;
  OpenChartParameters.PriorChartNumber = 0;
  OpenChartParameters.ChartDataType = WEEKLY_DATA; //This is what i *thought* would be there
  OpenChartParameters.Symbol = sc.GetRealTimeSymbol();
  OpenChartParameters.DaysToLoad = 360;
  sc.PersistVars->i11 = sc.OpenChartOrGetChartReference(OpenChartParameters);


Date Time Of Last Edit: 2014-06-26 09:48:58
[2014-06-28 22:37:28]
Sierra Chart Engineering - Posts: 104368
We will add support for this:
how to load a historical weekly/quarterly/yearly

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