Support Board
Date/Time: Tue, 22 Apr 2025 02:57:42 +0000
Post From: sc.ReadIntradayFileRecordForBarIndexAndSubIndex appears to not work for Volume based bars
[2025-02-16 07:01:06] |
Sierra_Chart Engineering - Posts: 19290 |
We are confirming there is no issue with Volume bars with that function. Here is an updated example of the function that is easier to follow. Also disable this Chart Setting: Chart Settings: Split Data Records (applies to Number of Trades, Volume and Range charts) (Chart >> Chart Settings >> Chart Data >> Chart Data menu) SCSFExport scsf_ReadChartBarRecordsFromUnderlyingIntradayFileExample(SCStudyInterfaceRef sc)
{ SCSubgraphRef SubGraph_Volume = sc.Subgraph[0]; if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Read Chart Bar Records from Underlying Intraday File Example"; sc.AutoLoop = 0; // This must be set to 1 in order to use the sc.ReadIntradayFileRecordForBarIndexAndSubIndex function. sc.MaintainAdditionalChartDataArrays = 1; SubGraph_Volume.Name = "File Volume"; SubGraph_Volume.DrawStyle = DRAWSTYLE_BAR; SubGraph_Volume.LineWidth = 2; SubGraph_Volume.PrimaryColor = RGB(255, 0, 128); SubGraph_Volume.DrawZeros = false; return; } if (sc.LastCallToFunction) return; s_IntradayRecord IntradayRecord; for (int BarIndex = sc.ArraySize - 10; BarIndex < sc.ArraySize; BarIndex++) { 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(BarIndex, SubIndex, IntradayRecord, IntradayFileLockAction); if (ReadSuccess) { TotalVolume += IntradayRecord.TotalVolume; ++SubIndex; } } sc.ReadIntradayFileRecordForBarIndexAndSubIndex(-1, -1, IntradayRecord, IFLA_RELEASE_AFTER_READ); SubGraph_Volume.Data[BarIndex] = TotalVolume; } } 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, use the Teton service: Sierra Chart Teton Futures Order Routing |