_SECTION_BEGIN("Karthik's_EOD_System");
//SYSTEM
M3 = EMA(C, 3);
M10 = EMA(C,10);
M30 = EMA(C,30);
Long_Setup = M3 > M30 AND M10 > M30;
Short_Setup = M3 < M30 AND M10 < M30;
Buy = Long_Setup AND M3 > M10 AND PDI(14) > MDI(14);
Sell = M3 < M10 OR PDI(14) < MDI(14);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = Short_Setup AND M3 < M10 AND PDI(14) < MDI(14);
Cover = M3 > M10 OR PDI(14) > MDI(14);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);
SetPositionSize(1,4);
//Plots
Plot(M3, "M03",colorBlue, styleLine);
Plot(M10,"M10",colorRed, styleLine);
Plot(M30,"\n\nSTOP LOSS = ",colorGreen,styleThick);
Plot(2,"",IIf(MDI(14) > PDI(14),colorRed,colorBlue), styleNoLabel | styleOwnScale | styleArea,-3,100);
PlotShapes(Buy *shapeUpArrow, colorBlue,0,L);
PlotShapes(Short*shapeDownArrow, colorRed, 0,H);
//PlotShapes(Cover * shapeSmallUpTriangle, colorBlue,0,L);
//PlotShapes(Sell * shapeSmallDownTriangle, colorRed, 0,H);
Filter = Buy OR Short;
SetOption("NoDefaultColumns", True );
AddColumn( DateTime(), "Date", formatDateTime );
AddTextColumn(Name() , "Ticker" );
AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
AddColumn(M30, "STOP AT");
AddColumn( Close, "Close" );
_SECTION_END();
_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();