Support Board
Date/Time: Sat, 08 Feb 2025 05:48:20 +0000
[Programming Help] - How can i get data of a specific candle from a different chart?
View Count: 638
[2020-06-29 09:39:18] |
GiovanniD - Posts: 41 |
For example: from a Range Bar chart I want to take the 09:00 AM candle data (High, Low, Open, Close) from the H60 chart #7. SCGraphData ChartOverlayArrays;
sc.GetChartBaseData(-Input_ChartOverlayNumber.GetChartNumber(), ChartOverlayArrays); if (ChartOverlayArrays[SC_OPEN].GetArraySize() == 0) return;//verifica che abbia caricato qualcosa int ChartNumber = Input_ChartOverlayNumber.GetChartNumber(); SCFloatArrayRef HighArray = ChartOverlayArrays[SC_HIGH]; // Do data processing int anno_ = sc.BaseDateTimeIn[sc.Index].GetYear(); int mese_ = sc.BaseDateTimeIn[sc.Index].GetMonth(); int giorno_ = sc.BaseDateTimeIn[sc.Index].GetDay(); SCDateTime Data_Cercata1 = YMDHMS_DATETIME(anno_, mese_, giorno_, 9, 00, 00); ArraySize = sc.GetNearestMatchForSCDateTime(ChartNumber, Data_Cercata1); //GetExactMatchForSCDateTime() GetNearestMatchForSCDateTime float high = HighArray[ArraySize]; int anno = sc.BaseDateTimeIn[sc.Index].GetYear(); int mese = sc.BaseDateTimeIn[sc.Index].GetMonth(); int giorno = sc.BaseDateTimeIn[sc.Index].GetDay(); Message.Format("Indice: %d High: %f Data: %d/%d/%d", ArraySize, high, giorno, mese, anno); sc.AddMessageToLog(Message,0); } Doing so: 1) The H60 Chart selected in input strangely change itself in M1 and this is not good, it must remain H60. 2) The High value that it found is incorrect.. Can you explain what's wrong? Thank's |
[2020-06-29 10:48:35] |
User907968 - Posts: 826 |
Remove the minus sysmbol preceding 'Input_ChartOverlayNumber.GetChartNumber()' from this line of code: sc.GetChartBaseData(-Input_ChartOverlayNumber.GetChartNumber(), ChartOverlayArrays);
Passing the chart number as a negative number causes synchronization between charts, see information here: sc.GetChartBaseData() |
[2020-06-30 07:22:56] |
GiovanniD - Posts: 41 |
Well, now it works Thank's |
To post a message in this thread, you need to log in with your Sierra Chart account: