Using AB 6.93.0 with Windows 11 and IQfeed data in mixed data mode. Real time periodicity is 1 minute.
I am trying to determine the length of each data array using Barcount()
I have read the posting on this forum and found topic with not quite same issue.
My program reads data for symbols in a watchlist, looks for the first data point and number of bars using barcount(). Finally writes the info to a text file.
The results I get is that all symbol arrays have the same first data date and all have the same length (which of course is not true).
Image of text file snippet attached
Appreciate any help
// File: Veryfy IQ feed Data
// June 2025
// version 0.1
Vers = 0.1;
//
// Purpose of TFM Trading System is to read all data and highlight data lenths shorter tha normal
//
// NOTE: Interval must be set to 1 minute to 1 minute data
// NOTE: Interval must be set to Daily for Daily data
// NOTE: Select Watchlist in A window
//
// Source_WL = "All Symbols";
//
// # include <Mod - Date Convert Functions.afl>
#pragma maxthreads 1;
// ===================================================== Gereral Variables and parameters ===============================================
//
bi = barindex();
lbi = lastvalue( bi );
ai = lbi - bi[0];
//
ProgramHeader = "Verify IQ Feed Data " + vers;
Pgm_Title = "Data Verify";
debug = Param( "debug", 0, 0, 1, 1 );
//
//
//Time_start = GetPerformanceCounter( bReset = True )
// ================================================================= Functions ==========================================================
// ================================================================= Write to Disk ======================================================
// Write header
function DataVarifySummary( symbol, bars, firstdata, token )
{
Date_string = StrReplace( NumToStr( DateNum(), 1.0 ), ",", "" );
//stock_num = StrReplace(NumToStr(stocknum,1.0),",","");
Filepath = "G:\\DataFiles\\Amibroker-EOD\\DailyBacktestSummary\\";
Filename = "IQfeedData - Verification - " + token;
//
//
_TRACE( "IQfeed-A1 - Filename " + FilePath + Filename + " firstdata " + writeval(firstdata,1.0) + " Bars " + writeval(Bars,1.0));
//
//File name includes date info, so only one file per day can be created
fhread = fopen( Filepath + filename + ".txt", "r", True ); // Test if file exists
_TRACE( "IQfeed-A2 - fhread " + fhread );
if( fhread == 0 )
// _TRACE( "IQfeed-A2 - fhread " + fhread );
{
_TRACE( "IQfeed-A3 - Inside file write process - Symbol " + Symbol );
fhw = fopen( Filepath + filename + ".txt", "w", True ); // Open file in Write Mode
//
_TRACE( "IQfeed-A4 - path " + Filepath + filename + ".txt" + " fhw " + fhw );
if( fhw )
{
//write header info
fputs( "IQfeed-A5 Data Verification - token " + token + "\n" , fhw );
//write 1st record
fputs( symbol + " Bars " + writeval( bars, 1.0 ) + " first date " + firstdata + "\n", fhw );
}
fclose( fhw );
}
else
{
//
fclose( fhread ); // CLose file in Read Mode
//
//
fha = fopen( Filepath + filename + ".txt", "a", True ); // Open existing file in amend mode
_TRACE( "IQfeed-A6 - fha " + fha );
if( fha )
{
fputs( symbol + " Bars " + writeval( bars, 1.0 ) + " first date " + firstdata + "\n", fha );
_TRACE( "IQfeed-A7 - Inside file amend proceess - Symbol " + Symbol );
} // end if (fha)
fclose( fha );
} // end fhread else
} // end function Disk write
//
//
//
token = "";
if( status( "stocknum" ) == 0 )
{
token = Now( 4 );
staticvarset("token",token);
_trace( "IQfeed-A0 " + token );
}
// Write to disk
Symbol = Name();
token = staticvarGet("token");
Bars = Barcount - 1;
//
// Find 1st data date
firstdata = datenum();
//fd_date = DateConvert_ABmmddyyyy( firstdata[0] ) ;
//
//Write data to disk text file
//DataVarifySummary( symbol, bars, fd_date, token );
DataVarifySummary( symbol, bars, firstdata, token );
//
//
_TRACE( "IQfeed-A8 - ----------------------------------------------------------------------------------------- " );