@nextpotato All indicators are based on conditional criteria logic, not colors... I say that for a reason... You need to know what determines the color of a candle in order to write the code you want... That being said, in the picture above the pink candles are down candles, meaning the closing price is lower than the opening price for that candle... The green candles close higher than they open... You see, it's logic, not colors... No more talk about colors, ok...??? We're talking about price trends...
Now, what you have depicted in the image is what we call trend reversal... However, the problem with trend reversals, as you are describing, is that without any other confirmations you never know whether what you think is the bottom is really the bottom... We have many trend reversal scripts here already and, unfortunately, many of them repaint which results in false signals... The Trend Reversal Indicator with Signals is a prime example... And Studies and Strategies that work virtually the way you are describing already exist... Reliability is the issue... As mentioned, the trend reversal itself is worthless without adequate confirmation...
You aren't describing anything new... Take the time to do ample research based on what I have explained... It would do no good to attempt to reinvent the wheel by writing inadequate code that already exists... Once you know about how to best recognize and act upon trends, such as combining with momentum, volume, convergence/divergence, candlestick action, or any of a number of other criteria, only then will you know what you want to code... As of right now you're stuck at the very basic concept that all too many new traders fixate on... It's not the reversal, it's the momentum for continuance that counts... Ever heard the term "dead cat bounce"...??? That's something that happens that fools many traders that focus on trend reversals alone...
While perhaps not the answer you wanted to hear I feel that it's the answer you needed to hear... If it was as simple as you've imagined and described, we'd all be filthy rich... And the reason we don't trade that way is because the concept in its simplest form is fundamentally flawed...
Do your research and see why I'm giving you this advice... You'll be glad I did in the end, and you won't have to suffer major losses to your trading account... You don't have to walk down that same path that so many others have trodden before you...