Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 00:43:50 +0000



Post From: Data Error using GetHighest with multiple timeframes

[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];