Login Page - Create Account

Support Board


Date/Time: Wed, 15 May 2024 13:00:50 +0000



Post From: scid real time file update question

[2017-10-29 12:34:57]
Sierra Chart Engineering - Posts: 104368
In 1631 you will have the ability to read the individual records for each chart bar easily.

This function demonstrates that:
/*============================================================================

----------------------------------------------------------------------------*/
SCSFExport scsf_ReadChartBarRecordsFromUnderlyingIntradayFileExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Read Chart Bar Records from Underlying Intraday File Example";
    
    sc.AutoLoop = 0;

    sc.FreeDLL = 0;

    //this must be set to 1 in order to use the sc.ReadIntradayFileRecordForBarIndexAndSubIndex function.
    sc.MaintainAdditionalChartDataArrays = 1;

    return;
  }

  if (sc.LastCallToFunction)
    return;

  s_IntradayRecord IntradayRecord;

  if ( sc.GetBarHasClosedStatus(sc.UpdateStartIndex) == BHCS_BAR_HAS_NOT_CLOSED)//Only execute on updating of last bar.
  {
    int ReadSuccess = true;
    bool FirstIteration = true;
    uint32_t TotalVolume = 0;
    int SubIndex = 0;//Start at first record within bar

    //Read records until sc.ReadIntradayFileRecordForBarIndexAndSubIndex returns 0
    while (ReadSuccess)
    {
      IntradayFileLockActionEnum IntradayFileLockAction = IFLA_NO_CHANGE;

      if (FirstIteration)
      {
        IntradayFileLockAction = IFLA_LOCK_READ_HOLD;

        FirstIteration = false;
      }

      ReadSuccess = sc.ReadIntradayFileRecordForBarIndexAndSubIndex(sc.ArraySize - 1, SubIndex, IntradayRecord, IntradayFileLockAction);

      if (ReadSuccess)
      {
        TotalVolume += IntradayRecord.TotalVolume;
        ++SubIndex;
      }
    }

    sc.ReadIntradayFileRecordForBarIndexAndSubIndex(-1, -1, IntradayRecord, IFLA_RELEASE_AFTER_READ);

    SCString TotalVolumeString;
    TotalVolumeString.Format("Total volume: %u", TotalVolume);

    sc.AddMessageToLog(TotalVolumeString, 0);
  }
  
}

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2017-10-29 12:36:24