OPEN-SOURCE SCRIPT

zigzag%

This is zigzag % , no repaint and no lag as it based on % changes
the main issue is the addition of take profit and stop loss together with trailing (thanks to Yatrader to his code)
set the zigzag% according to best fit of your graph for best results

Disclaimer