My objective is to track for each bar how many symbols in a watchlist were active (price >0), to be used to adjust # of positions to hold in a later step. I tweaked code from this forum, below, however the array "~Symctact" only starts counting several years after the 1st available symbol with data in the watchlist, testing with exploration. I tried with and without pad/align to the oldest symbol. Perhaps there is a needed code change, setting or simpler way to do this?
@swalk10 sorry to say but I too found your code to run into the same limitations. I tried a couple of things and I am guessing it is something we are setting incorrectly. But I have been looking through the user guide and can't figure it out. I bet its simple but just can't find it.
Hope some of the more knowledgeable users help out.
For what it is worth AmiBroker DOES NOT allow prices to be equal zero (or negative). ASCII importer will NOT import such data (unless you force ALLOWNEG) and all our plugins will NOT give prices = 0, so I don't see the point of doing what you are doing since in proper database there are NO symbols with price = 0.
Tomasz,
Thanks for the note. To clarify, I am not testing for zero prices, I am testing for prices that are above zero using this formula
Symctact = iif(c>0,1,0);
That was my attempt to capture the # of "actively" traded symbols on that bar; I would be much obliged if you could point how to better get this done.
Scott
Thanks for that idea; I will try volume and report back today.
Note - turning on/off pad aligned to the oldest tickers did not seem to change the outcome.
Calc seems to count accurately both active tickers and total # of tickers in watchlist; problem is that is starts the "active ticker" count several years after the 1st ticker has data, no matter the start of the date range in the settings. However, other fields populate correctly on the 1st bar of the range.
I setup a new clean database with just these symbols, using the volume trigger and now pad/align to oldest symbol does the trick. Not 100% sure which combination of things were necessary (clean database or volume trigger).