This script prints higher highs, higher lows, lower highs and lower lows, as well as the last support or resistance line.
It can be configured with one parameter "lookback" which determines how fast the trend changes direction.
Alerts can be setup for each event.
Please note: the triangles are plotted with a 1 bar offset, meaning you will receive the alert 1 bar after, since the script is waiting for a price drop/climb to validate a higher/lower high/low.