AFL code doesn't work on different computer

I use AFL formula (from this forum!) that updates the Watchlist from file (csv):

_SECTION_BEGIN("Import_pliku");
listnumTI = 2;  //Watchlist
file_path = "C:\\TradeIdeasPro\\ami.csv";

// erase the watchlist when we process very first symbol
	if ( Status( "stocknum" ) == 0 )
	{
		// retrieve watchlist members
		oldlist = CategoryGetSymbols( categoryWatchlist, listnumTI );
		// iterate through the list and remove tickers
		for ( i = 0; ( sym = StrExtract( oldlist, i ) ) != ""; i++ )
		{
			CategoryRemoveSymbol( sym, categoryWatchlist, listnumTI );
		}
	}
fh = fopen( file_path, "r");
if( fh )
{
	linecounter=0;
	while( ! feof( fh ) ) 
	{
		line=fgets(fh); /		
		if(linecounter>0)
		{
			importsymbol=StrExtract(line,0); 
			symbol=StrReplace(importsymbol,"\"",""); //delete "" from tickere made by TradeIdeas
			CategoryAddSymbol(symbol, categoryWatchlist, listnumTI );
		}
        else 
		{
		}
		linecounter++;
	}
}
else
{
   printf("ERROR: file can not be found (does not exist)");
} 
fclose(fh);
_SECTION_END();

It works perfect on one computer and updates the Watchlist, however it doesn't work on the other computer - when I run exploration, it doesn't update (add) tickers to watchlist. No errors apear. File path is correct. I use the same csf file exported from TradeIdeas.

Are there any settings that can lead to this problem? Amibroker runs on Windows10, 64bit, run as administrator.
Thanks in advance for suggestions.

Debug your code on second computer. To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?

I did it and no results (i.e. no errors). Exploration runs without any disruption, even time of run is the same on both computers. I also tried on different databases (local and live) - and the same problem: one computer is OK, second without results.

No, you didn't. Your code is missing out _TRACE and other debugging methods.

Besides you are realize that the code you posted on forum does not run at all because of syntax error (spurious / character).

image

and that the location of the fclose() is wrong (should be inside if statement).

Yes, sorry for the error in code I attached ( / ) - this is due to removing commentaries.
I'll change the position of fclose and test it again on the problematic computer and I'll post the results here. I also add _TRACE - thanks for suggestions (I thought that by debuging you mean just checking AFL code by debugger).

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.