Hi Karthik,
I guess you have to update your rules to correct this typo ( adding are not to your original post)
BTW, I am trying to write the AFL for this strategy for ease of use. Let me see how much I can progress. I am learning to code strategies. Pl. let me know if you have already done it.
Thanks
I guess you have to update your rules to correct this typo ( adding are not to your original post)
BTW, I am trying to write the AFL for this strategy for ease of use. Let me see how much I can progress. I am learning to code strategies. Pl. let me know if you have already done it.
Thanks
hi ,
Karthik has explained his EOD strategy,it would be helpfull if someone can code it to afl,
Thank You
Karthik has explained his EOD strategy,it would be helpfull if someone can code it to afl,
Thank You
***************
Friends,
Here is the AFL. Copy and save in your "AmiBroker/Formulas/Custom" folder.
Please note that this version does not contain Exit rules as the rules are not spelt out for Selling (Shorting). Once the rules are available, I will revise the AFL and post.
This AFL also contains Exploration. You can list the stocks which have generated a Buy or a Sell trigger. The Entry price and Stop Loss are also listed with the Triggers.
Hope this helps.
The AFL is here:
Code:
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);
_N(Title = EncodeColor(colorTurquoise) + "KARTHIK's EOD Strategy;"
+ EncodeColor(colorYellow) + " AFL by ANANT NAVALE, Version 1.00\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);
}
if(Status("action") == actionExplore)
{
Filter = Buy OR Sell;
SetOption("NoDefaultColumns", True);
AddTextColumn(Name(), "SYMBOL");
AddColumn(DateTime(), "DATE", formatDateTime);
AddColumn(IIf(Buy, 66, 83), "TRIG", formatChar, colorYellow, IIf(Buy, colorGreen, colorRed));
AddColumn(IIf(Buy, H, Null), "BUY ABOVE", 1.2);
AddColumn(IIf(Sell, L, Null), "SELL BELOW", 1.2);
AddColumn(IIf(Buy, L, H), "STOP LOSS", 1.2);
}
_SECTION_END();
-Anant