Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 01:19:12 +0000



Post From: Reading each trade price

[2018-10-07 13:37:27]
User585949 - Posts: 2
I've added to my study function to read bar details ( TimeFrame = 1 sec). This function is called on bars where high > close and low < close. But starting Replay Chart for testing on every examining bar IntradayRecord is filled only once when SubIndex = 0. On next loop passing, when SubIndex = 1 ReadIntradayFileRecordForBarIndexAndSubIndex always returns 0 ( no success).
Below is my code ( sc.MaintainAdditionalChartDataArrays = 1 in SetDefauls is added in main study function).
Am I doing something wrong ?

static void ReadBarDetails( SCStudyInterfaceRef sc, int Index )
{
  int ReadSuccess = true;
  bool FirstIteration = true;
  uint32_t TotalVolume = 0;
  int SubIndex = 0;//Start at first record within bar
  s_IntradayRecord IntradayRecord;
  while ( ReadSuccess )
  {
    IntradayFileLockActionEnum IntradayFileLockAction = IFLA_NO_CHANGE;
    if ( FirstIteration )
    {
      IntradayFileLockAction = IFLA_LOCK_READ_HOLD;
      FirstIteration = false;
    }
    ReadSuccess = sc.ReadIntradayFileRecordForBarIndexAndSubIndex( Index, 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 );
}
Date Time Of Last Edit: 2018-10-08 08:50:45