TradingView candle colors

How to change candle colors on TradingView

For ordinary candle colors, select Candles, open Chart settings, and use Symbol → Candles to change Body, Borders, and Wick. For rules such as coloring bars when RSI exceeds 70, use a Pine indicator: barcolor() recolors existing chart bars; plotcandle() draws a separate candle series with independent body, border, and wick colors.

Open the Visual Pine Editor

Change the native candle palette

On a standard Candles chart, open the gear icon and select Symbol. In the Candles section, set the up and down colors for Body, Borders, and Wick, then apply the settings. If only the candle center changes, check the border and wick controls separately. Other chart types expose different options.

  • Check "Color bars based on previous close" before interpreting the colors. When enabled, it compares the close with the previous close rather than the current open.
  • For example, open 100, close 102, and previous close 103 gives an up body by open-to-close comparison but a down color by previous-close comparison.
  • For a different chart background, use Canvas. A dark background alone does not define an RSI or price-based coloring rule.

Choose barcolor or plotcandle

Decide whether you are changing the existing price bars or adding your own OHLC drawing. Use one coloring indicator while testing so another script cannot obscure the result. Keep barcolor() and plotcandle() in global scope; put the condition in their arguments instead of putting those calls inside an if block.

RequirementControlFallback behavior
Fixed up/down paletteChart settings → SymbolThe selected chart type determines the native appearance
Highlight existing bars when a rule is truebarcolor()Pass na to leave that bar unchanged by this script
Use separate conditional body, wick and border colorsplotcandle()Pass na for an OHLC argument to omit the added candle

Complete Pine v6 example: RSI color rules

Paste this entire indicator into Pine Editor, save it, and add it to a standard Candles chart. With the default settings, a closed bar becomes orange when its 14-period RSI is above 70 or blue when RSI is below 30. Equality and the middle range receive no override. These thresholds demonstrate branching; they are not entry or exit instructions. Select Draw custom candles to compare the second rendering method without running a second script.

One complete indicator with two rendering modes and an RSI Data Window readout.pinescript
//@version=6
indicator("Conditional Candle Colors", overlay=true, behind_chart=false)

mode = input.string("Recolor chart bars", "Rendering", options=["Recolor chart bars", "Draw custom candles"])
enabled = input.bool(true, "Enable highlights")
waitForClose = input.bool(true, "Wait for bar close")
length = input.int(14, "RSI length", minval=1)
upperColor = input.color(color.orange, "RSI above 70")
lowerColor = input.color(color.blue, "RSI below 30")
customWick = input.color(color.gray, "Custom candle wick")

rsiValue = ta.rsi(close, length)
isReady = enabled and not na(rsiValue) and (not waitForClose or barstate.isconfirmed)
color ruleColor = na
if isReady
    if rsiValue > 70
        ruleColor := upperColor
    else if rsiValue < 30
        ruleColor := lowerColor

useChartBars = mode == "Recolor chart bars"
barcolor(useChartBars ? ruleColor : na, title="RSI chart highlights")
drawCustom = not useChartBars and not na(ruleColor)
plotcandle(drawCustom ? open : na, high, low, close, title="RSI custom candles", color=ruleColor, wickcolor=customWick, bordercolor=ruleColor)
plot(rsiValue, title="RSI for color rule", display=display.data_window)

Check the rule against boundary cases

This is a hypothetical logic test, not a backtest. Assume Enable highlights and Wait for bar close are on, the default colors are unchanged, and no other coloring script is active. The RSI column supplies an assumed calculated value; it does not claim a particular market produced that value. In TradingView, use the Data Window readout to inspect actual values before comparing the candle.

  • The two RSI branches cannot both be true. If you replace them with overlapping conditions, the first matching branch wins.
  • To test a price rule instead, define an exact comparison such as close above a moving average and specify what happens at equality. Keep the same readiness and fallback decisions.
RSI / bar stateRule resultRecolor chart barsDraw custom candles
71 / closedAbove 70Orange overrideOrange body/border, gray wick
70 / closedNeither strict comparisonNative appearanceNo added candle
50 / closedMiddle rangeNative appearanceNo added candle
30 / closedNeither strict comparisonNative appearanceNo added candle
29 / closedBelow 30Blue overrideBlue body/border, gray wick
71 / still openNot readyNative appearanceNo added candle
na / closedRSI unavailableNative appearanceNo added candle
71 / closed; highlights offDisabledNative appearanceNo added candle

Decide whether colors may change before close

An indicator recalculates during an open bar as new updates arrive. The latest close and RSI can move across a threshold repeatedly. Turning Wait for bar close off therefore allows a highlight to appear and disappear before the bar finishes. Historical bars do not preserve every intrabar color change.

  • With the toggle on, barstate.isconfirmed permits the highlight on historical bars and on the closing update of a live bar. It does not mean the next bar will keep the same condition.
  • The current chart timeframe supplies the confirmation in this example. If you add higher-timeframe data later, review confirmation of that data separately; barstate.isconfirmed inside request.security() is not a solution.
  • The script creates no alerts or orders. If you later add an alert, make its condition and timing match the color rule you intend to monitor.

Resolve colors that look wrong or do not appear

First turn Enable highlights off and compare the underlying chart. Then test one rendering mode at a time. In custom mode, the original chart candles still exist underneath the added series; the script uses behind_chart=false to draw its candles in front. Disabling a layer is a useful diagnostic, not proof that its conditions were wrong.

Observed resultCheck
No highlight at RSI 70 or 30The example deliberately uses strict > and < comparisons.
No color on the latest barWait for bar close may be on, or RSI may not yet be available.
The wick has a different colorCustom mode uses its own gray wick input. Change Custom candle wick.
Color disagrees with candle directionThe RSI rule is independent of close versus open. Native previous-close coloring is another separate comparison.
No improvement after changing chart settingsTemporarily hide coloring indicators and inspect the native palette again.
A scope error after editingKeep the plotting calls outside local if blocks; assign ruleColor inside them.
Where Pineify fits

Visual Pine Script Editor

Build supported indicator conditions and visual outputs in Pineify, then inspect the generated Pine Script and compare its chart output with your rule table.

Also useful: Pine Script AI Coding Agent. Describe more complex color priorities, fallback behavior, and confirmation timing to the coding agent, then review and test the generated indicator in TradingView.

Open the Visual Pine Editor

Frequently asked questions

Educational chart-coloring example only, not investment advice. Colors describe the stated conditions and do not establish profitable trades. Check the script on the chart type and timeframe you use.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.