SetChartBkColor(ParamColor("BkColor", colorBlack));
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} ", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
A = (H + L)/2;
MAL = MA(A, Param("LPeriods", 34));
MAS = MA(A, Param("SPeriods", 5));
AO = MAS - MAL;
AC = MA((AO - MA(AO, 5)), 5);
ACCOLOR = IIf(AC >= Ref(AC, -1), 1, -1);
AOCOLOR = IIf(AO >= Ref(AO, -1), 1, -1);
COLOR = IIf(ACCOLOR != AOCOLOR, colorGrey50, IIf(AOCOLOR == 1, colorRed, colorBrightGreen));
PlotOHLC(Open,High,Low,Close,"", COLOR, styleCandle);
AlligatorBlue=Ref(Wilders(A,13),-8);
AlligatorRed=Ref(Wilders(A,8),-5);
AlligatorGreen=Ref(Wilders(A,5),-3);
Plot(AlligatorGreen, "Green", ColorRGB(0, 255, 0), styleLine|styleNoLabel);
Plot(AlligatorRed, "Red", ColorRGB(255, 0, 0), styleLine|styleNoLabel);
Plot(AlligatorBlue, "Blue", ColorRGB(0, 0, 255), styleLine|styleNoLabel);
/*The following builds Fractal Up*/
var1=
(Ref(H,-2) >= Ref(H, -4)) AND
(Ref(H,-2) >= Ref(H, -3)) AND
(Ref(H,-2) >= Ref(H, -1)) AND
(Ref(H,-2) >= Ref(H, 0));
FractalUp=ValueWhen(var1,Ref(H, -2),1);
Plot(FractalUp, "F-Up", IIf(Close > FractalUp, colorBlack, colorPink), styleBar);
/*The following builds Fractal Down*/
var2=
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= Ref(L, 0)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -4));
FractalDown=ValueWhen( var2,Ref(L,-2),1);
Plot(FractalDown, "F-Down", IIf(Close < FractalDown, colorBlack, colorGold), styleBar);
Buy = Cross(Close, FractalUp);
IIf(Buy, PlotShapes(shapeHollowUpArrow*Buy, colorRed, 0, Low), 0);
Short = Cross(FractalDown, Close);
IIf(Short, PlotShapes(shapeHollowDownArrow*Short, colorBrightGreen, 0, High), 0); |