Support Board
Date/Time: Sun, 22 Dec 2024 16:50:34 +0000
Post From: Referencing BaseData from a Daily Chart
[2015-08-14 21:49:30] |
User424542 - Posts: 6 |
I'm trying to reference the High,Low, Open, and Close from the BaseData of a Daily Chart from a study that I have in a 5 min Chart. I would like to reference the previous day's HLOC and today's Open on the Daily Chart. When I run this on the daily chart it works but when I run it on my 5 minute chart, it does not work. SCInputRef ChartBaseData = sc.Input[7]; if (sc.SetDefaults) { ChartBaseData.Name = "Daily Chart"; ChartBaseData.SetChartNumber(3); return; } SCGraphData BaseData; sc.GetChartBaseData(ChartBaseData.GetChartNumber(), BaseData); SCFloatArrayRef PreviousDayHigh = BaseData[SC_HIGH]; float PrevDayHigh = PreviousDayHigh[sc.Index - 1]; SCFloatArrayRef PreviousDayLow = BaseData[SC_LOW]; float PrevDayLow = PreviousDayLow[sc.Index - 1]; float PrevDayAvg = (PrevDayHigh + PrevDayLow) / 2; SCFloatArrayRef TodayOpen = BaseData[SC_OPEN]; float DayOpen = TodayOpen[sc.Index]; I need to run it on the 5 minute chart because we would like to flatten all trades at the close of day and the formula for flattening does not work on the daily chart as it needs to access HMS from the 5 minute chart. I have checked the chart number and it's 3. |