Hello
I am looking for Pinescript code to find the last (most recent) green ( close above open) or red (close below open) candle from the current candle. I want to return the opening price in either scenario.
Thank you for any help!
Code: Select all
ta.valuewhen(close>open, open, 1)