Dear : Everybody.
I am learning AFL. Please help me code as below picture. I don't understand how to write with "\n" with 4 symbols.
Thanks for help.
Title = "Relative Performance [%] : {{VALUES}} " + "\n" ;
TickerList = ParamStr("Tickers", "^TECH,^SOFT,^CAR,^HEAL,^BUILDING") ;
NumBars = 100;
fvb = Status("firstvisiblebar");
Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlue );
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
{
fc = Foreign( symbol, "C" );
if( ! IsNull( fc[ 0 ] ) )
{
Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ],
symbol,
colorLightOrange + ( (2*i) % 15 ),
styleLine);
}
}
PlotGrid( 0, colorYellow );
nsm51
October 9, 2025, 3:07pm
2
You have to read this:
AmiBroker Knowledge Base » Customizing chart titles
In plot() functions, add the flag styleNoTitle OR
remove " {{VALUES}}" in special variable Title depending on what you want to achieve.
NOTE: if you are removing {{VALUES}} then you have to make sure you write the whole Title string yourself in the format you want, and AB will not add anything automatically.
AB Title is highly customizable.
Thanks @nsm51 .
Yes! I read it.
But I don't know how to write value of symbol + "\n"
Huynq99:
{{VALUES}}
Dear @nsm51 .
I do it as below. Thanks for help.
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
{
fc = Foreign( symbol, "C" );
if( ! IsNull( fc[ 0 ] ) )
{
Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ],
symbol,
colorLightOrange + ( (2*i) % 10 ),
styleLine);
}
Title += EncodeColor(colorLightOrange + ( (2*i) % 10 )) + symbol + ": "+ NumToStr( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ] , 1.2) + "\n";
}
PlotGrid( 0, colorYellow );
nsm51
October 9, 2025, 4:09pm
5
if you are doing this, don't use ParamStr().
ParamStr will return only 1 selected string.
TickerList = "a,b,c,d,e"; // full string
If you want to learn AFL and get quick help, I strongly suggest you use the AFL code wizard with AI.
1 Like
I used wizard with AI . Very very slow. I used LLM gemini and then deleted.