Plotting Relative Performance

EXTREME Newbie here.

I'm trying to plot my 401k performance against DJI and SPY.
I'm using what I think is the built in foreign function to do this but all that's plotting is the 401k. I'm sure I'm doing something simple stupid but what?

_SECTION_BEGIN("Relative Performance");
_N( TickerList = ParamStr("Tickers", "DJI,401k,SPY") );
NumBars = 20;
fvb = Status("firstvisiblebar");
Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorRed );
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
 fc = Foreign( symbol, "C" );

 if( ! IsNull( fc[ 0 ] ) )
   Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ], symbol, ColorRed + ( (2*i) % 15 ), styleLine );
PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );

You need to have DJI and SPY in your database. Do you have them?

I have a symbol ($) in front of all my index tickers. Maybe check you have written them correctly in your afl?

Thanks, Chris.

I tried that. It didn't work for me.
I use Interactive Brokers as a data source.


Doh! Yes, I had it in my updater but not in the watchlist I am using. Thanks for assisting Mr. obvious. I told you I was a newbie.

This brings up another issue I'm having. I use Interactive Brokers' updater and I also have Amiquote. I don't know how the two database updaters interact. How do I tell which one is updating a particular symbol. Am I making a mistake by using both?

I am sorry but I learned on my own mistakes so many times that the most obvious things are hardest to catch. So I triple check obvious things.

As to your second question it is covered in the manual , scroll down to "Things you should NOT do, or you should do very carefully" section for extensive discussion on how it works and what to look for.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.