OPEN-SOURCE SCRIPT

Good Candles with Risk Table

This custom Pine Script indicator highlights bullish and bearish candles based on the highest and lowest close prices over the past specified number of candles (look-back period).

Bullish candles are marked with an orange color when the close is higher than the highest close from the previous candle.
Bearish candles are marked with a purple color when the close is lower than the lowest close from the previous candle.
The indicator also draws two lines for each colored candle:

Midline: A horizontal line drawn at the midpoint between the open and close of the candle, which helps visualize the candle's body.
Open line: A horizontal line drawn at the open price, offering an additional reference point for market action.
Lines are visible for the last 5 colored candles (either bullish or bearish), with old lines being removed to avoid clutter on the chart.

Additionally, the Risk Table at the top right of the chart shows the calculated units to buy for the specified risk amount (default value of $0.1), based on the distance between the candle’s close and its midpoint. This allows users to manage their risk effectively by knowing how many units they should purchase to match their desired risk level.
Candlestick analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer