Differences between pinescript version 4 and 5

 TradingView has released version 5 of pinescript with some new features. Some of the coders from old version may find that names of commonly used indicators have changed. I am listing here few of the changes that I noticed while converting and running  version 4 script in version 5. 

1. The "transp" property from plotshape function and plot function have been removed. You can use transp property from color.new function.

2. All the technical indicators are now required to be accessed from a "ta" namespace i.e. sma will be written as ta.sma, ema will become ta.ema and so on. Futher some of the other functions will also require "ta" namespace line ta.crossover or ta.valuewhen

3. Math functions has been moved to "math" namespace. The commonly used abs function is now required to be written as math.abs

4. The "iff" statement is no more, you have to convert all the statements written in "iff" to ternary operator using "?".

5. The name of study function has been changed to "indicators".

6. The most waited "while" loop has been included in version 5

7. Switch statement has been introduced in the new version of pinescript.

Apart from the above major changes that you may face while converting pinescript version 4 script to version 5, you will notice new features in version 5.

Libraries have been introduced and now you can also use default values in the user defined functions. We will discuss these new features in next post. 

Happy programming !

Resources

Highest Rated Udemy Course on PineScript - Grab your Seat Now 

Udemy Discount Coupon Code : UDEMY-JAN23 (Valid upto 30th Nov 2023)

Learn more about coding on tradingview in PineScript through Books on pinescript available on amazon and kindle.


200+ pages book100 pages book200+ pages book


Point and Figure Charts : A Time-Tested Tool for Technical Analysis

In the dynamic world of financial markets, investors and traders constantly seek tools that can provide valuable insights into market trends...