Login Page - Create Account

Support Board


Date/Time: Wed, 22 Jan 2025 04:13:58 +0000



Post From: new version doesn't support setting sc.VolumePerBar

[2018-08-25 10:11:23]
User44804 - Posts: 7
Thank you for the quick reply. I have added an if-loop and now it's working. Here is the code in case somebody else wants to create such a function:

sc.DataStartIndex =sc.ArraySize-3;
  
  if((sc.ArraySize-2)<sc.Index)
    return;
  else
  
  
  {
  
  SCGraphData StudyData;
  sc.GetStudyArraysFromChartUsingID(Chartnumber.GetChartNumber(), Chartnumber.GetStudyID(), StudyData);
  
  // Define a reference to the first Subgraph array
SCFloatArrayRef SubgraphArray = StudyData[0];

int RefChartIndex = SubgraphArray.GetArraySize()-2;
  
  
  
  
  float NearestSubgraphValue = SubgraphArray[RefChartIndex];
  VolumeStudy[sc.Index]=SubgraphArray[RefChartIndex-1]/Divisor.GetInt();
  int a = (int) VolumeStudy[sc.Index];
  
  
  
  n_ACSIL::s_BarPeriod NewBarPeriod;
  
  sc.GetBarPeriodParameters(NewBarPeriod);
  
  NewBarPeriod.ChartDataType = INTRADAY_DATA;
  NewBarPeriod.IntradayChartBarPeriodType = IBPT_VOLUME_PER_BAR;
  NewBarPeriod.IntradayChartBarPeriodParameter1 = a;
  if((sc.VolumePerBar < 0.95*a) || (sc.VolumePerBar > 1.05*a) )
  {
    sc.SetBarPeriodParameters(NewBarPeriod);
  }
  
    
  
  
  }

Kind regards