Display multiple symbols in one chart

I would like to display a number of stocks in one chart pane as well as an average of the stocks displayed. I've searched the forum as well as the instructions and help topics and I'm sure it's somewhere but I've missed it. Can someone please point me to the instructions.

1 Like

In AmiBroker go to Charts - Basic Charts and apply "Relative Perfomance" AFL.

Below is that upper mentioned AFL by AmiBroker where I've added average performance in addition.

/// Relative Performance.afl by AmiBroker.com 
/// to be found in Charts window -> Basic Charts
/// Added average performance line
/// https://forum.amibroker.com/t/display-multiple-symbols-in-one-chart/24101
_N( TickerList = ParamStr( "Tickers", "^DJI,MSFT,GE" ) );

fvb = Status( "firstvisiblebar" );

//Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlue );

i = n = all_avg = 0;
for ( ; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
    fc = Foreign( symbol, "C" );
    if ( NOT IsNull( fc[ 0 ] ) )
        relP = 100 * ( fc - fc[ fvb ] ) / fc[ fvb ];
        Plot( relP, symbol, colorLightOrange+((2*i) % 15), styleLine );
        all_avg += relP;

all_avg /= n;
Plot( all_avg, "Average", colorLightOrange+((2*i) % 15));

PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );

@RonCompton, welcome to this community forum.

Unfortunately, it is not clear to me what you want to do.

Anyway, I suggest searching the forum for "relative performance" (for a type of chart that compares
the performance of a stock vs. some others) or these old threads here and here for multiple low level "gfx" charts.

If that's not what you're looking for, try rephrasing the question, perhaps posting a sample image of what you want to achieve.

can Plot (100 * (C - C [fvb]) / C [fvb], Name (), colorBlue); given the name / label, according to the ticker name . Thanks


Please take a look at KB article here.

Entire KB is must read and one of three main sources for search queries.

Other sources:
AB documentation.
This forum.

1 Like

Thank you very much Sir

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