modify a script in pinescript

Job ID: 38323496

Budget: $10 – $30 CAD

Hello,

i have this script, a fractal zigzag MTF, i want to modify the logic slightly.

In its actual form, it's a zigzag between fractals high and low, quite basic.

The modification would be that in the absence of an opposing fractal, when breaking a peak (or trough), the new point of the zigzag is the lowest (or highest) between the initial fractal and the point of passing.

See the image in exemple, yellow zigzag is how it is now, and blue zigzag would be the modified results.

I also joint the code so you can check this out.

thanks
Related categories: Pine Script Trading