draw lines with historical price HLCO pine script

Job ID: 35236583

Budget: $30 – $250 USD

I would need an indicator that draws horizontal lines that it reads from left to right the price.
The line (on a timeframe which I can modify) must start on or a high or on a low or on the pivot body (i.e. candle closure green + red candle opening or the opposite) and must look back e see how many touches it has in the last 100 candles (put a modifiable parameter).

In the picture I put a yellow shadow on you so you can better understand what I mean. For example, the first line up, starts from a top and then touches a body pivot (green closure red opening, exactly on the body). So that
line must appear.
The second line always starts from a high then touches an open a dojy and a to close.
The third line starts from a high and then touches a low.
The fourth line starts from a pivot body (green close + red open) e has a touch back to a green close+green open)
As past touches I need either high or low or close+open(type close green candle always green opening) or pivot body (red closing green opening or the opposite)
The line that has priority is the most recent and closest high/low/body pin at the price.
No line should remain on the graph that does not have at least 2 hits.
Related categories: Pine Script Trading MetaTrader 4 Metatrader 5