Plot small horizontal lines at fractals / Pivots

//Alligator

AG = (H+L)/2;
AlligatorJaw   = Ref(Wilders(AG, 13), -8);
//Plot(AlligatorJaw, "Jaw", colorBlue, styleLine );
AlligatorTeeth = Ref(Wilders(AG, 8), -5);
//Plot(AlligatorTeeth, "Teeth", colorRed, styleLine );
AlligatorLips  = Ref(Wilders(AG, 5), -3);
//Plot(AlligatorLips, "Lips", colorGreen, styleLine );

LTHist = AlligatorLips - AlligatorTeeth;
LJHist = AlligatorLips - AlligatorJaw;
TJHist = AlligatorTeeth - AlligatorJaw;

MaxGator = Max(AlligatorLips, Max(AlligatorTeeth, AlligatorJaw));
MinGator = Min(AlligatorLips, Min(AlligatorTeeth, AlligatorJaw));

Plot(AlligatorJaw,  "Jaw", ParamColor("Jaw's Color",colorBlue),
ParamStyle("Jaw's Style", styleThick));
Plot(AlligatorTeeth,"Teeth", ParamColor("Teeth's Color",colorRed),
ParamStyle("Teeth's Style", styleThick));
Plot(AlligatorLips, "Lips", ParamColor("Lips's Color",colorGreen),
ParamStyle("Lips's Style", styleThick))
;//*/

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    

//Bill Williams Fractals

// Fractal Up 
fUp =
        (Ref( H, -2)  > Ref(H, -4)) 
    AND (Ref( H, -2)  > Ref(H, -3))
    AND (Ref( H, -2)  > Ref(H, -1))
    AND (Ref( H, -2)  > H);
    

// Fractal Down
fDn =
    (Ref(L, -2)  < Ref(L, -4)) AND
    (Ref(L, -2)  < Ref(L, -3)) AND
    (Ref(L, -2)  < Ref(L, -1)) AND
    (Ref(L, -2)  < L);

var1	= ValueWhen(fUp, Ref( H, -2 ), 1);
var2	= ValueWhen(fDn, Ref( L, -2 ), 1);

Fractalup = HighestSince( var1 > 0, var1, 1);
Fractaldn = LowestSince ( var2 > 0, var2, 1);

//Plot(Fractalup, "F Up", colorBlue , styleLine | styleDashed );
//Plot(Fractaldn, "F Dn", colorRed , styleLine | styleDashed );

PlotShapes(IIf(Ref(Fractalup, 2) != Ref(Fractalup, 1), shapeSmallupTriangle, shapeNone),   colorBrightGreen, 0, H, 5);
PlotShapes(IIf(Ref(Fractaldn, 2) != Ref(Fractaldn, 1), shapeSmallDownTriangle, shapeNone), colorRed,         0,  L, 5); 

THe above code gives Triangles over fractals as shown in screenshot 1
I also need to have horizontal lines of 4 pixels above the high as in Screenshot 2

Screenshot 1
Screenshot (2)

Hello Vikas.sood,

a possible solution could be to study LineArray function ...

https://www.amibroker.com/guide/afl/linearray.html

Best regards,
Peter

1 Like

Thank you , Pietro.
Now I know where to start.

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