@BoNeZ ,
Two more methods for this,
1. Using TimeFrame Compress/Expand on Charts:
SetChartOptions( 1, chartShowDates );
WatchListNum = 5; // As per "index.txt" located in AmiBroker Database Directory -> Watchlists folder. Count starts from "0".
SymList = CategoryGetSymbols( categoryWatchlist, WatchListNum ); // To retrieve the Tickers from Watchlist # 5. Just add/remove symbols to/from the watchlist.
SelTF = ParamList( "Select Timeframe", "Daily|Weekly|Monthly|Quaterly|Yearly", 0 );
SelPer = ParamList( "Select Period", "Selected|Previous Till Selected|Prev-To-Prev Till Selected", 0 );
LblFntSz = Param( "Label font size", 8, 4, 30, 1 );
err = 0;
NoLabel = 0;
bi = BarIndex();
switch( SelTF ) {
case "Daily":
if( Interval() <= inDaily ) {
switch( SelPer ) {
case "Selected":
if( Interval() == inDaily ) {
err = 1;
errMsg = "Select any chart Interval less than Daily Timeframe,\nto view selected day's Relative Performance chart.";
}
else {
BeginBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inDaily, compressOpen ), inDaily, expandFirst ) );
EndBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inDaily, compressLast ), inDaily, expandFirst ) );
}
break;
case "Previous Till Selected":
if( Interval() == inDaily ) {
BeginBar = SelectedValue( Ref( bi, -1 ) );
EndBar = SelectedValue( bi );
NoLabel = 1;
}
else {
BeginBar = SelectedValue( TimeFrameExpand( Ref( TimeFrameCompress( bi, inDaily, compressOpen ), -1 ), inDaily, expandFirst ) );
EndBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inDaily, compressLast ), inDaily, expandFirst ) );
}
break;
case "Prev-To-Prev Till Selected":
if( Interval() == inDaily ) {
BeginBar = SelectedValue( Ref( bi, -2 ) );
EndBar = SelectedValue( bi );
NoLabel = 1;
}
else {
BeginBar = SelectedValue( TimeFrameExpand( Ref( TimeFrameCompress( bi, inDaily, compressOpen ), -2 ), inDaily, expandFirst ) );
EndBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inDaily, compressLast ), inDaily, expandFirst ) );
}
break;
}
}
else {
err = 1;
errMsg = "Select chart's Interval less than or equal to Daily,\nto view Daily Relative Performance chart";
}
break;
case "Weekly":
if( Interval() <= inWeekly ) {
switch( SelPer ) {
case "Selected":
if( Interval() == inWeekly ) {
err = 1;
errMsg = "Select any chart Interval less than Weekly Timeframe,\nto view selected week's Relative Performance chart.";
}
else {
BeginBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inWeekly, compressOpen ), inWeekly, expandFirst ) );
EndBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inWeekly, compressLast ), inWeekly, expandFirst ) );
}
break;
case "Previous Till Selected":
if( Interval() == inWeekly ) {
BeginBar = SelectedValue( Ref( bi, -1 ) );
EndBar = SelectedValue( bi );
NoLabel = 1;
}
else {
BeginBar = SelectedValue( TimeFrameExpand( Ref( TimeFrameCompress( bi, inWeekly, compressOpen ), -1 ), inWeekly, expandFirst ) );
EndBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inWeekly, compressLast ), inWeekly, expandFirst ) );
}
break;
case "Prev-To-Prev Till Selected":
if( Interval() == inWeekly ) {
BeginBar = SelectedValue( Ref( bi, -2 ) );
EndBar = SelectedValue( bi );
NoLabel = 1;
}
else {
BeginBar = SelectedValue( TimeFrameExpand( Ref( TimeFrameCompress( bi, inWeekly, compressOpen ), -2 ), inWeekly, expandFirst ) );
EndBar = SelectedValue( TimeFrameExpand( TimeFrameCompress( bi, inWeekly, compressLast ), inWeekly, expandFirst ) );
}
break;
}
}
else {
err = 1;
errMsg = "Select chart's Interval less than or equal to Weekly,\nto view Weekly Relative Performance chart";
}
break;
/*
SelTF case for Monthly, Quaterly, Yearly in similar manner
*/
}
/*
Rest is similar to the KB "How to add symbol labels to Relative Performance chart" apart from few modifications as requested.
(Link https://www.amibroker.com/kb/2015/08/29/how-to-add-symbol-labels-to-relative-performance-chart/)
*/
if( err ) {
SetChartBkColor( ColorRGB( 50, 0, 0 ) );
Title = errMsg;
}
else {
PosX = ( BeginBar + 9 * EndBar ) / 10;
for( i = 0; ( symbol = StrExtract( SymList, i ) ) != ""; i++ ) {
fc = Foreign( symbol, "C" );
if( ! IsNull( fc[ 0 ] ) ) {
RelP = IIf( bi >= BeginBar && bi <= EndBar, 100 * ( fc - fc[ BeginBar ] ) / fc[ BeginBar ], Null );
Plot( RelP, symbol, color = colorLightOrange + ( ( 2 * i ) % 15 ), styleNoLabel );
if( !NoLabel )
PlotTextSetFont( symbol, "Arial", LblFntSz, PosX, RelP[ PosX ], GetChartBkColor(), color, -LblFntSz / 2 );
}
}
_N( Title = StrFormat( "%s %s Relative Performance %% in {{INTERVAL}} interval\n{{VALUES}}", SelPer, SelTF ) );
}
/*_______________________________________________________________________________________________________________________
|This code is for AmiBroker Formula Language (AFL) learning (non-commercial) purposes only. Please do not copy this code|
|(or any other version of it) and paste it over on other forums or anywhere else on the Internet or in any other form |
|without the AmiBroker Forum owner's consent (https://forum.amibroker.com/). |
_______________________________________________________________________________________________________________________*/
//https://forum.amibroker.com/t/fixed-starting-point-for-charts/15488/3?u=cougar

2. Using Scatter (X-Y) charts in Exploration:
The last section of this guide introduces XYChartSetAxis and XYChartAddPoint. Also, @ beppe and @ fxshrat has also provided similar examples in this forum.
ChName = "Rel. Performance";
XYChartSetAxis( ChName, "", "[%]", styleLine );
bi = BarIndex();
bir = Status( "BarInRange" );
fbir = LastValue( ValueWhen( Status( "FirstBarInRange" ), bi ) );
lbir = LastValue( ValueWhen( Status( "LastBarInRange" ), bi ) );
RelP = 100 * ( C - C[ fbir ] ) / C[ fbir ];
color = colorLightOrange + ( ( 2 * Status( "StockNum" ) ) % 15 );
for( j = 0; j < BarCount; j++ ) if( bir[ j ] ) XYChartAddPoint( ChName, "", j, RelP[ j ], color, color );
XYChartAddPoint( ChName, Name(), lbir, RelP[ lbir ], color, color );
XYChartAddPoint( ChName, "", Null, Null );
/*_______________________________________________________________________________________________________________________
|This code is for AmiBroker Formula Language (AFL) learning (non-commercial) purposes only. Please do not copy this code|
|(or any other version of it) and paste it over on other forums or anywhere else on the Internet or in any other form |
|without the AmiBroker Forum owner's consent (https://forum.amibroker.com/). |
_______________________________________________________________________________________________________________________*/
//https://forum.amibroker.com/t/fixed-starting-point-for-charts/15488/3?u=cougar