Plot Candle
Yaser Rahmati | آکادمی رحمتی
Last updated
Yaser Rahmati | آکادمی رحمتی
Last updated
This script will correctly plot candlesticks on the TradingView chart, coloring the bodies of the candles green if the close is higher than the open and red otherwise. The wicks will be orange, and the borders of the candles will be white.
This line specifies that the script is written in Pine Script version 5.
This line defines a new indicator named "Plot Candle". When this script is applied to a chart, this name will be shown in the list of applied indicators.
candleColor
: This variable determines the color of the candle to be plotted based on the condition (close > open)
.
if (close > open)
: This is a conditional statement that checks if the closing price (close
) is greater than the opening price (open
).
color.green
and color.red
: These are predefined colors in Pine Script. If the condition (close > open)
is true, candleColor
is set to green; otherwise, it's set to red.
plotcandle(open, high, low, close, title = "CANDLE", color = candleColor, wickcolor = color.orange, bordercolor = color.white)
The plotcandle
function is used to plot candlesticks on the chart.
It uses the open
, high
, low
, and close
prices to draw the candlesticks.
The title
parameter sets the name of the plotted candles to "CANDLE".
The color
parameter sets the color of the candle body to the value determined by candleColor
(either green or red).
The wickcolor
parameter sets the color of the wicks (shadows) to orange (color.orange
). Note that there is a typo in the script where it says color.orage
instead of color.orange
.
The bordercolor
parameter sets the color of the candle borders to white (color.white
).
pine script
, trading view
, script editor
, indicators
, strategies
, backtesting
, alerts
, custom scripts
, stock analysis
, charting tools
, technical analysis
, built-in functions
, pine script syntax
, trading bots
, automated trading
, scripting language
, market data
, trading signals
, financial markets
, programming trading strategies
, یاسر رحمتی