This article will cover the topic of coloring the background of charts in tradingview, coloring candlesticks, and plotting different types of shapes on the chart. Colouring is important to highlight important points or levels on the chart.
- Coloring background
- Coloring candlesticks
- Plotting shapes
Change Background color
There are two functions in the pine script that are used to color the background on the chart.
- fill(line1, line2)
fill is a built-in function in pine script that is used to color the background between two lines. You need to specify the limits in the fill function. It will fill the space between two lines with color. All other options are available like offset, length, and transparency.
You can also make overlay true or false according to the requirement.
study("My Script", overlay=true) bgcolor(color=color.red) high1 = plot(high) low2 = plot(low) fill(high1,low2, color=color.black, transp=50)
bg color means background color. This function in the pine script is used to color the complete background of the chart. Use appropriate background color to highlight the color of candlesticks.
The most important use of this function is to highlight different trading sessions (London session, Tokyo session, Asian session) in the forex market.
study("My Script", overlay=true) bgcolor(color=color.red) plot(high) plot(low)
Coloring Candlesticks in Pine script
Bar color is a built-in function that is used to color candlesticks in the pine script programming language. A lot of customizations regarding candlesticks color can be done using this function.
This function is specially set for candlesticks that are why it does not matter either overlay is true or false. It will change the color of candlesticks according to input.
study("My Script", overlay=true) barcolor(color=color.blue) plot(high) plot(low)
Plotting shapes in Pine Script
Plotting shapes on the chart is one of the useful methods to indicate a signal either bullish or bearish depending on the arrow’s direction. A beginner can easily pick a trading signal by looking at the arrow direction.
There are different types of shapes available in the pine script language.
plot arrow is the built-in function that is used to plot arrows on the chart to forecast price direction in the pine script. If the input value is negative, then it will plot a down arrow. On the other side, if the value is positive then it will plot an up arrow. Arrow length and color can also be customized easily.
The built-In function that is used to plot shapes in pine editor is plot shape. You can also change the location of shapes on the bar by typing shape. And a dropdown will appear. Choose the appropriate location of shape from the drop-down menu.
Look at the code below. If open is greater than close, then it will plot shape above the candlestick.
study("My Script", overlay=true) high1 = plot(high) low2 = plot(low) fill(high1,low2, color=color.black, transp=50) shape1 = open>close plotshape(shape1, style=shape.diamond, color=color.red, transp=50)
I hope you will like this Article. For any Questions Comment below, also share by below links.
Note: All the viewpoints here are according to the rules of technical analysis. we are not responsible for any type of loss in forex trading.
Discover Hidden Opportunities with Supply & Demand indicator
It will draw real-time zones that show you where the price is likely to test in the future.