Last active
September 19, 2021 10:10
-
-
Save marketcalls/99388aa49aca1855ea02d57ece406b4e to your computer and use it in GitHub Desktop.
Simple EMA Crossover High-Low Breakout Trading System - Amibroker AFL code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coded by Rajandran R | |
//Founder of Marketcalls - www.marketcalls.in | |
//Co-Founder of Febinars - www.febinars.com | |
//For Premium Trading Strategies visit - www.traderskart.in | |
_SECTION_BEGIN("EMA Crossover High-Low Breakout Strategy"); | |
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); | |
SetChartOptions(0,chartShowArrows|chartShowDates); //Enable X-Axis (Date/Time Axis) | |
Plot(Close,"Candles",colorDefault,styleCandle); //Plot Candles | |
Plot(EMA(Close,13),"EMA-13",colorGreen , styleLine | styleThick); //Plot Short EMA lines | |
Plot(EMA(Close,34),"EMA-34",colorBlue , styleLine | styleThick); //Plot Long EMA Lines | |
buycond = Cross(EMA(C,13),EMA(C,34)); | |
sellcond = Cross(EMA(C,34),EMA(C,13)); | |
buyhigh = ValueWhen(buycond,H); //Extract the BuyHigh Levels | |
selllow = ValueWhen(sellcond,L); //Extract the Sell Low Levels | |
buycond1 = Flip(buycond,sellcond); | |
sellcond1 = Flip(sellcond,buycond); | |
Buy = buycond1 AND Cross(H,buyhigh); | |
Sell = sellcond1 AND Cross(selllow,L); | |
Buy = ExRem(Buy,Sell); | |
Sell = ExRem(Sell,Buy); | |
BuyPrice = Max(Open,buyhigh); | |
SellPrice = Min(Open,selllow); | |
SetPositionSize(1*RoundLotSize,spsShares); | |
/* Plot Buy and Sell Signal Arrows */ | |
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment