Page 1 of 1

Plot/Draw line chart highs/lows according to rules

Posted: Sat Sep 24, 2022 9:57 pm
by MrPdub247
Effectively, I want to create a line chart that only plots based on my rules.

Rules:

If the next candle breaks the previous candles high, it's considered part of the UP move.

The candle that doesn't break the previous candles high is considered to be a pullback.

Or

If the next candle breaks the previous candles low, it's considered part of the Down move.

The candle that doesn't break the previous candles low is considered to be a pullback.


Hopefully these images make it a bit clearer.

https://www.tradingview.com/x/jnCRPIXn/
https://www.tradingview.com/x/6gwcqAJm/


:question: Is this possible in PineScript? How difficult do you consider this to code?