FAQ

How to fix the `transp` argument will be deprecated soon error?

How to fix the `transp` argument will be deprecated soon error?

You may have noticed the following warning message in your PineScript indicator scripts: The `transp` argument will be deprecated soon. We recommend using color.new() or color.rgb() functions to specify the transparency of the plots instead.

Below is an example of code that causes this warning.

//@version=4
study("My Script")
plot(close, color = color.green, transp = 50)

Why does this error occur?

This warning message occurs simply because PineScript is deprecating (ending support) the ‘transp’ parameter in all Pine Script plotting functions. The purpose of this error message is to notify you about this deprecation and the new way of specifying transparency in Pine Script code. 

How do you resolve this warning? 

Now that PineScript decided to cease support for the ‘transp’ parameter in plotting functions, it also introduced a color.new and color.rgb function. These will make it possible for you to create scripts that are shaded in a variety of colors and gradients. Instead of using the transp parameter to specify transparency or opacity in visual plots, you need to use these new color.new() or color.rgb() functions. 

Note: simply resolve the warning message by going through your Pine Scripts by replacing the old ‘transp’ code with the new color.new or color.rgb functions. 

Here’s how to use the color.new Pine Script function. 

//@version=4
study("My Script")
plot(close, color = color.new(color.green, transp = 50))

Here’s how to use the color.rgb function that works with the RGB color palette.

//@version=4
study("My Script")
plot(close, color = color.rgb(0, 255, 0, transp = 50))

These two new functions provide a new way to specify the transparency of your plots. So go right ahead and use them to replace lines that are showing “The `transp` argument will be deprecated soon. We recommend using color.new() or color.rgb() functions to specify the transparency of the plots instead.” error message. 


Follow me on TradingView and YouTube.

This image has an empty alt attribute; its file name is wide.png
Pine Script Programming Courses
Pine Script Programming Courses
Learn to build your own TradingView Indicators and Strategies
Sidebar Signup Form
If you want to be the first in this business, subscribe to the latest news