Skip to content

Instantly share code, notes, and snippets.

@DTM-SC
Last active June 2, 2019 13:01
Show Gist options
  • Save DTM-SC/5969878ab257bc5223cc7f7a07577e39 to your computer and use it in GitHub Desktop.
Save DTM-SC/5969878ab257bc5223cc7f7a07577e39 to your computer and use it in GitHub Desktop.
_SECTION_BEGIN("EMA-9×26 Crossover by Daily Trade Mantra");
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",colorBlue), styleCandle);
EMAfast = EMA(C, 9);
EMAslow = EMA(C, 26);
PriceBuysignal = 0;
PriceShortsignal = 0;
//Buy and Sell condition
Buy = Cross(EMAfast, EMAslow);
Sell = Cross(EMAslow, EMAfast);
Short = Cross(EMAslow, EMAfast);
Cover = Cross(EMAfast, EMAslow);
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Cover = ExRem( Cover, Short );
Short = ExRem( Short, Cover );
//Price to Buy or Sell
BuyPrice = ValueWhen(Buy, Close);
SellPrice = ValueWhen(Sell, Close);
ShortPrice = ValueWhen(Short, Close);
CoverPrice = ValueWhen(Cover,Close);
//Manage your Fund and Trade amount
//SetPositionSize(100000,spsValue);
Plot(EMA(C,26),"EMA26",ParamColor("EMA26-Color",colorLightOrange));
Plot(EMA(C,9),"EMA9",ParamColor("EMA9-Color",colorBrightGreen));
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLime, 0,L, Offset=-25);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLime, 0,L, offset = -35);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLime, 0,L, offset = -45);
PlotShapes(IIf(Sell, shapeUpArrow, shapeNone),colorYellow, 0,L, Offset=-15);
PlotShapes(IIf(Sell, shapeUpArrow, shapeNone),colorYellow, 0,L, Offset=-25);
PlotShapes(IIf(Sell, shapeUpArrow, shapeNone),colorYellow, 0,L, Offset=-35);
PlotShapes(IIf(Sell, shapeUpArrow, shapeNone),colorYellow, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorOrange, 0,H, Offset=-15);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorOrange, 0,H, Offset=-25);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorOrange, 0,H, Offset=-35);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorOrange, 0,H, Offset=-45);
PlotShapes(IIf(Cover, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-15);
PlotShapes(IIf(Cover, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
PlotShapes(IIf(Cover, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-35);
PlotShapes(IIf(Cover, 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