SetChartOptions(0, chartShowDates | chartWrapTitle);
SetChartBkColor(colorBlack);
_SECTION_BEGIN("Karthik_EOD");
P1 = Param("Shorter EMA Period", 3, 2, 100, 1);
P2 = Param("Longer EMA Period", 10, 3, 200, 1);
P3 = Param("ADX Period", 14, 3, 100, 1);
E1 = EMA(C, P1);
E2 = EMA(C, P2);
DPLUS = PDI(P3);
DMINUS = MDI(P3);
Buy = E1 > E2 AND DPLUS > DMINUS;
Sell = E2 > E1 AND DMINUS > DPLUS;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
Bought = Flip(Buy, Sell);
Sold = Flip(Sell, Buy);
XIT = E1 < L OR E1 > H;
_N(Title = EncodeColor(colorTurquoise) + "KARTHIK's EOD Strategy;"
+ EncodeColor(colorYellow) + " AFL by ANANT NAVALE, Version 1.50\n\n"
+ EncodeColor(colorWhite) + StrFormat("{{NAME}} ({{INTERVAL}}, {{DATE}}; {{OHLCX}}; {{VALUES}}\n")
+ EncodeColor(colorBrightGreen) + WriteIf(Buy, "Buy Above : " + H + "; SL = " + L, "")
+ EncodeColor(colorPink) + WriteIf(Sell, "Sell Below : " + L + ", SL = " + H, ""));
if(Status("action") == actionIndicator)
{
Plot(C, "", colorLightGrey, styleCandle);
Plot(E1, "EMA(" + P1 + ")=", colorBrightGreen, styleLine | styleThick);
Plot(E2, "EMA(" + P2 + ")=", colorRed, styleLine | styleThick);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
PlotShapes(IIf(Bought AND XIT, shapeHollowDownArrow, shapeNone), colorYellow, 0, H, -15);
PlotShapes(IIf(Sold AND XIT, shapeHollowUpArrow, shapeNone), colorSkyblue, 0, L, -15);
}
if(Status("action") == actionExplore)
{
Filter = Buy OR Sell OR XIT;
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "SYMBOL");
AddColumn(DateTime(), "DATE", formatDateTime);
AddColumn(IIf(Buy, 66, IIf(Sell, 83, 88)), "TRIG", formatChar, colorYellow, IIf(Buy, colorGreen, IIf(Sell, colorRed, colorBlue)));
AddColumn(IIf(Buy, H, Null), "BUY ABOVE", 1.2);
AddColumn(IIf(Sell, L, Null), "SELL BELOW", 1.2);
AddColumn(IIf(XIT, Null, IIf(Buy, L, H)), "STOP LOSS", 1.2);
}
_SECTION_END();