About Fractal Indicator

Hello Sir,
I need One help From You . pls Help me sir

This query is about Fractal Indicator .

fractal

Below is the afl code for the above image.

Sir I need to plotshapes for Fractal up and down (ie., Red and White circle) for the Last Fractal Values only and not for All Fractals…

how to code it…

and also i tried ref() function but it wont worked. or guide me to solve this issue.

_SECTION_BEGIN(“Price”);
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”, colorBlack ), styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN(“BW Fractal”);
ShowFSign = ParamToggle(“Display Fractal Point”, “No|Yes”, 1);

FUp =
((Ref(H,-4)<Ref(H,-2)) AND (Ref(H,-3)<Ref(H,-2)) AND (Ref(H,-1) <Ref(H,-2)) AND (H <Ref(H,-2))) OR
((Ref(H,-5)<Ref(H,-2)) AND (Ref(H,-4)<Ref(H,-2)) AND (Ref(H,-3)<=Ref(H,-2)) AND (Ref(H,-1)< Ref(H,-2)) AND (H <Ref(H,-2))) OR
((Ref(H,-6)<Ref(H,-2)) AND (Ref(H,-5)<Ref(H,-2)) AND (Ref(H,-4)<=Ref(H,-2)) AND (Ref(H,-3)<=Ref(H,-2)) AND (Ref(H,-1)<Ref(H,-2)) AND (H <Ref(H,-2))) OR
((Ref(H,-7)<Ref(H,-2)) AND (Ref(H,-6)<Ref(H,-2)) AND (Ref(H,-5)<=Ref(H,-2)) AND (Ref(H,-4)<=Ref(H,-2)) AND (Ref(H,-3)<=Ref(H,-2)) AND (Ref(H,-1)<Ref(H,-2)) AND (H <Ref(H,-2))) OR
((Ref(H,-8)<Ref(H,-2)) AND (Ref(H,-7)<Ref(H,-2)) AND (Ref(H,-6)<=Ref(H,-2)) AND (Ref(H,-5)<=Ref(H,-2)) AND (Ref(H,-4)<=Ref(H,-2)) AND (Ref(H,-3)<=Ref(H,-2)) AND (Ref(H,-1)<Ref(H,-2)) AND (H <Ref(H,-2)));

FractalUp = ValueWhen(FUp ,Ref(H,-2) ,1);

FDown=
((Ref(L,-4)>Ref(L,-2)) AND (Ref(L,-3)>Ref(L,-2)) AND (Ref(L,-1) >Ref(L,-2)) AND (L > Ref(L,-2))) OR
((Ref(L,-5)>Ref(L,-2)) AND (Ref(L,-4)>Ref(L,-2)) AND (Ref(L,-3)>=Ref(L,-2)) AND (Ref(L,-1) >Ref(L,-2)) AND (L > Ref(L,-2))) OR
((Ref(L,-6)>Ref(L,-2)) AND (Ref(L,-5)>Ref(L,-2)) AND (Ref(L,-4)>=Ref(L,-2)) AND (Ref(L,-3)>=Ref(L,-2)) AND (Ref(L,-1) >Ref(L,-2)) AND (L > Ref(L,-2))) OR
((Ref(L,-7)>Ref(L,-2)) AND (Ref(L,-6)>Ref(L,-2)) AND (Ref(L,-5)>=Ref(L,-2)) AND (Ref(L,-4)>=Ref(L,-2)) AND (Ref(L,-3)>=Ref(L,-2)) AND (Ref(L,-1)> Ref(L,-2)) AND (L > Ref(L,-2))) OR
((Ref(L,-8)>Ref(L,-2)) AND (Ref(L,-7)>Ref(L,-2)) AND (Ref(L,-6)>=Ref(L,-2)) AND (Ref(L,-5)>=Ref(L,-2)) AND (Ref(L,-4)>=Ref(L,-2)) AND (Ref(L,-3)>=Ref(L,-2)) AND (Ref(L,-1)> Ref(L,-2)) AND (L >Ref(L,-2)));

FractalDown=ValueWhen(FDown, Ref(L,-2), 1);

PlotShapes(IIf((Ref(FractalUp,2) != Ref(FractalUp,1)) AND ShowFSign, shapeSmallCircle, shapeNone), colorRed,0,Ref(FractalUp,2), 12);
PlotShapes(IIf((Ref(FractalDown,2) != Ref(FractalDown,1)) AND ShowFSign, shapeSmallCircle, shapeNone), colorWhite,0,Ref(FractalDown,2), -12);

_SECTION_END();

with regards,
Elango

@Elango edit your post and insert proper code blocks

1 Like

Sir Now i Understood …

Sorry Sir .