[amibroker] Detecting last symbol in a scan

 

Hi,

Can anyone explain why scan code, as applied to "All Symbols" and the entire available date range, fails to accurately count the number of symbols in the scan?  The last line of test.tsv is "39798 of 45873" and "MADE_IT_HERE.txt" is not created.  It would be nice if detecting when a scan is on the last symbol were as straightforward as detecting when it is on the first (as with status("stocknum") == 0).

Thanks


#pragma maxthreads 1

Filter = 1;

SymbolNum = Status("stocknum");
SymbolCount = 0;

if (SymbolNum == 0) {
    SymbolCount = 1 + StrCount(CategoryGetSymbols(categoryAll, 0), ",");
    StaticVarSet("SymbolCount", SymbolCount, False, False);
}
SymbolCount = StaticVarGet("SymbolCount");

while ((fh = fopen("Y:\\temp\\test.tsv", "a", False)) == 0) ThreadSleep(100);
Line = StrFormat("%g\tof\t%g\n", SymbolNum, SymbolCount);
fputs(Line, fh);
fclose(fh);

if (SymbolNum == SymbolCount - 1) {
    if ((fh = fopen("Y:\\temp\\Made_It_Here.txt", "w", False)) != 0) fclose(fh);
    StaticVarRemove("SymbolCount");
}


__._,_.___

Posted by: rgearyiii@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___


EmoticonEmoticon