Zigzag AFL with actual Swing H/L

Can anybody help me to create a Zigzag AFL with actual Swing H/L? (It should be only with respect to price "HH & HL" , "LH & LL" NOT with any % or number of bars.)

  1. Avoid any "Inside/Outside" bar within the swing.

  2. Include the outside bar's swing if it cleared the previous Swing H/L as shown in the image 2.

I know your time is valuable and I appreciate your attention.

Swing Pivot 2 Swing Pivot