MrPdub247
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: September 24th, 2022

Plot/Draw line chart highs/lows according to rules

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?

Return to “Pine Script Q&A”