Try this-
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("temp");
for(i=0;i<BarCount;i++)
{Plot( IIf( BarIndex()>=BarCount -21, EMA( C, 21), Null ), "ema",
colorRed,styleLine);}
_SECTION_END()
--- In [email protected], "osp2osp" <osp2...@...> wrote:
>
> How to plot 21 days EMA only for the last 21 bars.
>
> Thank you.
>
> Warm Regards.
>
> K Karunakaran
>