Inserting RSI on chart using AFL code

I want to add RSI oversold and overbought panel at the bottom of chart panel, but code below combines them together as one chart. What am i doing wrong, sorry new to amazing Amibroker platform here.


SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) \n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", ParamColor( "Color", colorDefault ), styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );

Plot( BBandTop(C, BBTopPeriods, BBTopWidth), "UBB", colorGreen, styleDashed );
Plot( BBandBot(C, BBBottomPeriods, BBBottomWidth), "LBB", colorWhite, styleDashed );

//// Insert RSI
periods = Param( "Periods", 15, 1, 200, 1 );
oversold = Param( "Oversold level", 15, 1, 100, 1 );
overbought = Param( "Overbought level", 85, 1, 100, 1 );

Plot( RSI( periods), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style")  );
PlotGrid( oversold );
PlotGrid( overbought );

@subsoft you should insert the price+BB and the RSI code in 2 different "panes".

See this section of the AmiBroker tutorial to learn more about the AmiBroker user interface.

To create a new empty pane just select the appropriate item from this menu (triggered clicking on the + small button immagine ).
Select the new pane, edit your formula in the code editor and "apply" it to the new pane.



Thanks @beppe, I was thinking of accomplishing all this using AFL code. Can this be done through code.

Please check this ..I think this is the one you are looking for

Prfect! thank you @amsai, that will do.