Pine Script

A feature-rich development environment

Built to run today

Pine script is a language created by TradingView to test strategies and create custom indicators. Pine Script is lightweight and objectives can usually be achieved with fewer lines of code compared to other programming languages. This makes Pine Script useful for both those who are new and experienced in writing custom trading scripts. It's not based on any language in particular but shares similarities with Python and Kotlin. 

One thing to note is that Pine Script can't use external libraries within its processes, for example machine learning. However, similar to Tuned Script, it’s relatively simple to learn and the syntax is easy to understand. Due to current popularity, tutorials and discussion boards already exist, smoothing the learning curve.

Learn more

Ready to get started?

Writing code with Pine

To build a strategy with Pine Script, you need to follow a set of rules. Here are the basics:

Inform the script editor of the Pine version, for example: //@version=4

Define the strategy and include a name, for example: strategy("EMA Cross", overlay=true)

Define buy and sell conditions with strategy.order() and strategy.close()