Good day everyone,
i have following problem and i am hoping for some pointers in the right direction.
I am trying to count 'active' Stocks on Norgate Data because i would like to find out what percentage of Stocks closed positive within the Index.
To do this i open the Watchlist 'SP500 Current and Past' which currently contains 1229 Stocks, from these 1229 stocks it should contain a bit more than 720 Delisted stocks (Today).
This obviously does not work as said watchlist contains all of those stocks:
NoM = StrCount( MarketList, "," ) ;
I then try to count them inside a loop:
Count = 0;
for ( i = 0; ( symbol = StrExtract( marketlist, i ) ) != ""; i++ )
SetForeign ( symbol );
Count += NOT IsNull(C);
This also gives me 1229 Stocks. Now if i open a chart of one of the Delisted stocks from the backtest Report, it will have valid OHLCV values for example untill a certain Date in 2013, and then the Data just stops.
My Question, what am i doing wrong ? Should i be comparing the date of the Stock to the Date of the AFL to exlude those delisted Stocks, if so how could this be achieved ?
Actually i do and i was certain to find the solution there, so i went over it again a few times.
In that thread i was looking to ignore symbols that had empty tickers, here i try to do the opposite and
exclude them. Nz converts null to zero and the below statement checks for valid prints if i am correct ? What are you saying, where am i going wrong here ?
count += NOT IsNull(C);
Above example which was the solution you gave me give me at that time, gives me all symbols including delisted ones. 58 symbols on the $DJI. Shouldnt it add 1 to every Closing print that contains a valid value ? There must be something i am missing.
My reply came in a bit late i see. I didnt think about using Norgate's function but that seems logical. Let me try that, i am not yet familiar with StaticVar Add/Get but i am sure with your information and after a bit of reading i can make this work.