Thinkscript for specific trendline

Job ID: 37117980

Budget: $30 – $250 USD

Need a trendline that connects the highs or lows of 3 points before ever going through any candlesticks. Once the three high points have been connected (or 3 low points) then it can go through other candlesticks but it cannot go through any candles until at least 3 points have connected.

These points need to be the highest (or lowest for down sloping trendline) of the candle before it and after it, not two consecutive candles with same height.

Want this to work on all timeframes as far back as the chart goes.

Pictures attached to illustrate it.