Hi All. I’ve been active and inactive with amibroker over the years and now active again. I’m an intermediate level AFL programmer.
I like to look at Closed end funds. Closed end funds are mutual funds that trade throughout the day like securities. They have an associated NAV which is updated daily. Ticker of NAV is USUALLY by the formula: X+Ticker+X. So for example, the CEF PCI’s nav is XPCIX. We can code this in amibroker as the following:
Ticker = “X”+Name()+"X
and then whatever we want to do with Foreign(ticker,etc…)
The problem I am running into is that for some tickers, the names are exceptions. For example,
ADX --> NAV: XADEX
BXMX -> NAV: XBMXX
CHN -> NAV: XXCHNXX
I wanted to do this through a switch statement after checking for presence/Truth of the “X”+Name()+“X” ticker which I think can be done through a IF setforeign(Ticker)==0 (null).
However the Switch(CEF)
Case “ADX” : Ticker = “XADEX”;
Default: Ticker = “X”+CEF+“X”;
is not possible as it switch/case doesn’t work with strings.
So to avoid a laundry list of IFF’s or If/Then statments, anyone know a better way to do this? In python it would be a dictionary, but I have no idea how to do that in AFL except maybe by using two watchlists - one for the CEF’s and the other for the NAV’s , and that seems more complicated than its worth to me.
Anyone see a more obvious answer I am missing? Thanks