Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 05:26:00 +0000



Post From: How can i get data of a specific candle from a different chart?

[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