Login Page - Create Account

Support Board


Date/Time: Mon, 10 Mar 2025 07:07:23 +0000



Post From: Reading the Intraday chart data file records from the chart data file

[2022-03-14 13:50:32]
1+1=10 - Posts: 270
Did you see SC's example in /ACS_Source/Studies2.cpp? Did you use sc.ReadIntradayFileRecordAtIndex() the way they did in the example? I'm posting it below. Note that they are looping over the IntradayRecords themselves and not adding the additional processing required to determine which IntradayRecords apply to each BarIndex:


SCSFExport scsf_ReadFromUnderlyingIntradayFileExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Read from Underlying Intraday File Example";


    sc.AutoLoop = 0;

    return;
  }

  if (sc.LastCallToFunction)
    return;

  s_IntradayRecord IntradayRecord;

  for (int FileIndex = sc.FileRecordIndexOfLastDataRecordInChart; FileIndex >= sc.FileRecordIndexOfLastDataRecordInChart - 10; FileIndex--)
  {
    bool FirstIteration = FileIndex == sc.FileRecordIndexOfLastDataRecordInChart;
    bool LastIteration = FileIndex <= sc.FileRecordIndexOfLastDataRecordInChart - 10;
    IntradayFileLockActionEnum IntradayFileLockAction = IFLA_NO_CHANGE;

    if (FirstIteration && LastIteration)
      IntradayFileLockAction = IFLA_LOCK_READ_RELEASE;
    else if (FirstIteration)
      IntradayFileLockAction = IFLA_LOCK_READ_HOLD;
    else if (LastIteration)
      IntradayFileLockAction = IFLA_RELEASE_AFTER_READ;

    sc.ReadIntradayFileRecordAtIndex(FileIndex, IntradayRecord, IntradayFileLockAction);

    SCDateTimeMS TradeTimestampInChartTimeZone = IntradayRecord.DateTime;

  }

  // Could also use this line of code to release the lock if not sure when will be complete
//with reading and want to do it as a separate operation. An index of -1 signifies not actually to
// perform a read.
  
///sc.ReadIntradayFileRecordAtIndex( -1, IntradayRecord, IFLA_RELEASE_AFTER_READ);
    

}



Date Time Of Last Edit: 2022-03-14 13:52:20