How to display EMA13-EMA34 continuously on screen

...
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Double EMA Crossover Rules");

P1 = ParamField("Price field",-1);
Periods1 = Param("Periods1", 13, 2, 300, 1, 10 );
Plot( EMA( P1, Periods1 ), _DEFAULT_NAME(), ParamColor( "Color1", colorCycle ), ParamStyle("Style1") );

P2 = ParamField("Price field",-1);
Periods2 = Param("Periods2", 34, 2, 300, 1, 10 );
Plot( EMA( P2, Periods2 ), _DEFAULT_NAME(), ParamColor( "Color2", colorCycle ), ParamStyle("Style2") );

Buy = EMA(P1, Periods1) > EMA(P2, Periods2);
Sell = EMA(P1, Periods1) < EMA(P2, Periods2);

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

Filter=Buy OR Sell;
SetOption("NoDefaultColumns", True );
AddColumn( DateTime(), "Date", formatDateTime );
AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
addcolumn( Close, "Close price", 1.4 );

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

_SECTION_END();

...

@milind please follow the rules of the forum and properly format your posts if posting code.

A possible solution to your question,

Periods1 = 15; // Param("Periods", 15, 2, 30, 1 );
Periods2 = 34; // Param("Periods2", 34, 30, 100, 1 );

MA1 = EMA( C, Periods1 );
MA2 = EMA( C, Periods2 );

Plot( MA1, "MA(" + periods1 + ")", colorLightBlue, styleLine );
Plot( MA2, "MA(" + periods2 + ")", colorLime, styleLine );
1 Like