Login Page - Create Account

Support Board


Date/Time: Sun, 29 Dec 2024 00:16:04 +0000



Post From: sc.OpenChartOrGetChartReference

[2016-04-20 21:09:44]
User99735 - Posts: 234

void LoadChartsFunc(SCStudyGraphRef sc, int CALLPUT, int index, char* OptionName)
{
  s_ACSOpenChartParameters OpenChartParameters;
  OpenChartParameters.ChartDataType = INTRADAY_DATA; //This can also be set to: DAILY_DATA
  OpenChartParameters.Symbol = OptionName;//When want to use the symbol of the chart the study function is on, use sc.GetRealTimeSymbol()
  OpenChartParameters.IntradayBarPeriodType = IBPT_DAYS_MINS_SECS;
  OpenChartParameters.IntradayBarPeriodLength = SECONDS_PER_MINUTE; // 30 minutes
  OpenChartParameters.DaysToLoad = 0;//same as calling chart

  OpenChartParameters.PriorChartNumber = 0;


  sc.OpenChartOrGetChartReference(OpenChartParameters);

}

void LoadCharts(SCStudyGraphRef sc)
{
  char OptionName[100];
  int lowPrice = (int)(round(sc.BaseData[SC_LAST][sc.Index]) - OPTIONCHARTCOUNT / 2);
  int highPrice = lowPrice + OPTIONCHARTCOUNT;
  int index = 0;
  for (int price = lowPrice; price < highPrice; price++)
  {
    for (int CALLPUT = 0; CALLPUT < 2; CALLPUT++)
    {
      strcpy(OptionName, sc.Symbol);
      strcat(OptionName, "-OPT-");
      char temp[32];
      sprintf(temp, "%i", PermData->NextFridayInt);
      strcat(OptionName, temp);
      strcat(OptionName, "-");
      sprintf(temp, "%i", price);
      strcat(OptionName, temp);
      if (CALLPUT == CALL)
        strcat(OptionName, "-C");
      else
        strcat(OptionName, "-P");
      strcat(OptionName, OptionSuffix);

      LoadChartsFunc(sc, CALLPUT, index, OptionName);
    }
    index++;
  }
}