Hello
This seems pretty straightforward but I've been looking for days for a solution with nothing to show.
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!