Plot Arrow
FXC911 – Forex & Crypto News & Insights
Goals
This script creates a custom indicator called "Plot Arrow" that plots arrows based on the difference between the closing and opening prices of each bar. If the closing price is higher than the opening price, a green upward arrow is plotted. If the closing price is lower than the opening price, a red downward arrow is plotted. The arrows have a fixed height of 50 units.
Pine Script Code
//@version=5
indicator("Plot Arrow")
arrowType = close - open
plotarrow(arrowType, title = "ARROW", colorup = color.green, colordown = color.red, minheight = 50, maxheight = 50)
Code Output

Explanation
//@version=5
This line specifies that the script is written in Pine Script version 5.
indicator("Plot Arrow")
This line declares an indicator with the name "Plot Arrow". This name will appear on the chart when the indicator is added.
arrowType = close - open
This line defines a variable
arrowType
which is calculated as the difference between the closing price (close
) and the opening price (open
) of each bar (candlestick).
plotarrow(arrowType, title = "ARROW", colorup = color.green, colordown = color.red, minheight = 50, maxheight = 50)
plotarrow
is a function used to plot arrows on the chart.arrowType
: The data series based on which the arrows are plotted. Positive values will plot upwards arrows, and negative values will plot downwards arrows.title = "ARROW"
: Sets the title of the plotted arrows to "ARROW".colorup = color.green
: Specifies that the arrows pointing upwards (whenarrowType
is positive) will be green.colordown = color.red
: Specifies that the arrows pointing downwards (whenarrowType
is negative) will be red.minheight = 50
andmaxheight = 50
: Set the minimum and maximum height of the arrows to 50 units. This keeps the arrow size constant regardless of the value ofarrowType
.
Keywords
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
Visit me on:
🚀 Finance & Trading Insights: fxc911.ir
🐦 Twitter: x.com/fxc911_official/
Last updated