Plot Character And Text
Yaser Rahmati | یاسر رحمتی
Last updated
Yaser Rahmati | یاسر رحمتی
Last updated
The script creates an indicator that plots a green dollar sign ('$') below bars where the closing price is higher than the opening price (bullish bars), and a red dollar sign ('$') above bars where the closing price is lower than the opening price (bearish bars). Alongside the dollar signs, the texts "BULLISH" and "BEARISH" are displayed in white color for bullish and bearish conditions, respectively. The indicator overlays these plots directly on the price chart.
This specifies that the script is written in Pine Script version 5.
This defines an indicator named "Plot Char" and specifies that the plots should be overlaid on the main price chart (as opposed to being in a separate pane).
bullish = close > open
: This defines a boolean variable bullish
that is true when the closing price of the current bar is higher than the opening price.
bearish = close < open
: This defines a boolean variable bearish
that is true when the closing price of the current bar is lower than the opening price.
plotchar(bullish, char = '$', location = location.belowbar, color = color.green, text = "BULLISH", textcolor = color.white, size = size.small)
: This plots a green dollar sign ('$') below the bar when the bullish
condition is true. The text "BULLISH" is displayed next to the character in white color and small size.
plotchar(bearish, char = '$', location = location.abovebar, color = color.red , text = "BEARISH", textcolor = color.white, size = size.small)
: This plots a red dollar sign ('$') above the bar when the bearish
condition is true. The text "BEARISH" is displayed next to the character in white color and small size.
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
, یاسر رحمتی