I am trying to calculate the equal weighted historical average daily total return across tickers in S&P 100 index over time. For some reason my code generates a result starting on March 20, 2019, but nothing prior to that. I am confused why that is. Any assistance appreciated. Note that I am using data and functions supplied by Norgate Data.
My Watchlist is set to "S&P 100 Current & Past". The date range on the Explore is set to 1/1/2017 thru 3/1/2024.
For some reason the output of the Explore gives results every day in the columns labeled "Close" and "TR", but the output is blank for dates prior to 3/20/2019 in the columns labeled "TotCount", "TotTR", and "AvgTotTR". But for dates after 3/20/2019 there is data in those 3 columns that looks correct. Why would those columns not have any output at all (i.e. blank) prior to March 20, 2019 in the output of my Explore? Is my Norgate database corrupt?
Thanks for your reply. No I did not have the Pad and Align box checked. But I went into the settings and checked that box and the result is the same. The ticker associated with the Pad and Align box is currently set to ^DJI. I'm not sure if I should set that ticker to something else?
Okay I believe I am getting much closer. I rewrote the AFL code using StaticVarAdd instead of looping through each symbol individually. This seems to work better as now I am getting results for each date in the Explore date range. However when I run the Explore I'm not sure how to set the Filter so I only get the last symbol in the SP100 index on each day. But I can work that out in Excel, I would just prefer to know how to do this using Amibroker Explore.
Some of you guys don't get it.
You do not need any AFL looping for that and shouldn't.
It is not needed and not recommended.
Neither for ranking nor for this.
Just use Staticvaradd here and enable pad&align with proper symbol.