Plot Shape And Text
Yaser Rahmati | یاسر رحمتی
Last updated
Yaser Rahmati | یاسر رحمتی
Last updated
This Pine Script code creates an indicator that plots a small red downward arrow above bars where the closing price is higher than the opening price (bullish bars). The text "Sig" is displayed next to the arrow in green color. The indicator overlays these plots directly on the price chart.
//@version=5
: Specifies that the script is written in Pine Script version 5.
indicator("Plot Shape", overlay = true)
: Defines an indicator named "Plot Shape" and specifies that the plots should be overlaid on the main price chart.
diff = close > open
: Defines a boolean variable diff
that is true when the closing price of the current bar is higher than the opening price (a bullish condition).
plotshape(diff, title = "SHAPE", style = shape.arrowdown, location = location.abovebar, color = color.red, text = "Sig", textcolor = color.green, size = size.small)
:
diff
: The condition to determine whether to plot the shape. The shape will be plotted when diff
is true.
title = "SHAPE"
: The title of the plot.
style = shape.arrowdown
: Specifies the shape style, in this case, a downward arrow.
location = location.abovebar
: Places the shape above the bar.
color = color.red
: Sets the color of the shape to red.
text = "Sig"
: Displays the text "Sig" next to the shape.
textcolor = color.green
: Sets the color of the text to green.
size = size.small
: Sets the size of the shape to small.
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
, یاسر رحمتی