Need AFL Code to find major fractals with at least one ATR length

Hello everyone, I have a simple code to find out fractals.

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

SwingLow = Low < Ref(Low, 1) and low < Ref(Low, 2) AND Low < Ref(Low, -1) and low < Ref(Low, -2);
upFractal = ValueWhen(SwingLow, Low, 1);

SwingLHigh = High > Ref(High, 1) and High > Ref(High, 2) AND High > Ref(High, -1) and High > Ref(High, -2);
DownFractal = ValueWhen(SwingLHigh, High, 1);

PlotShapes(IIf((Ref(upFractal,0) != Ref(upFractal,-1)) AND ShowFSign, shapeUpArrow, shapeNone), colorGreen,0,Ref(upFractal, 1), -12);
PlotShapes(IIf((Ref(DownFractal,0) != Ref(DownFractal,-1)) AND ShowFSign, shapeDownArrow, shapeNone), colorRed,0,Ref(DownFractal, 1), -12);


Now I wanted to have and plot fractals (up down) if only if there is at least one ATR(14) change between two fractals (up or down).

The idea is to find major fractals by measuring the length between two up or down fractals.

Thanks in advance

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.