Home > Blog > Pine Script Tutorial > Introduction to Pine Script

Introduction to Pine Script

Published by Ali Muhammad
Updated on

Pine script is a simple, lightweight, and cloud-based programming language by tradingview which is used to create custom indicators, Alerts, and backtest trading strategies using historical data.

A Code basically consists of constants, variables, and functions. Conditions are applied to get the desired output. We apply specific conditions and whenever the program meets those conditions then it operates.

pine script
Pine Script Editor by Tradingview

Pine Script Example

For example, you want the program to run whenever there is a pin bar candle in the EURUSD currency chart and in a specific timeframe.

You will code a script by applying conditions of a pin bar like candle must have 80% wick and 20% body. Code will run on every tick. Whenever conditions will fulfill it will give you an alert or show you graphically on a chart. It depends on your code. Simple is that

Prior knowledge of any programming language is not necessary. Tradingview has made it simple for traders by developing a pinescript. Because if you are using any other language then you need to source data but tradingview has most of the built-in stuff. This feature makes it simple and less complicated than any other programming language.

pine script example
Bullish hammer code by Tradingview

Pine script vs mql4

  1. Pine script is a cloud-based programming language and can be accessed anywhere from the internet whereas in the case of mql4 you need to install mt4 on a PC.
  2. There are a lot of built-in open-source indicators in tradingview which can be used to optimize a code like using moving average to filter trend and range. In the case of mql4, you need to search on different blogs on the internet.
  3. Already built-in codes of almost all the candlestick patterns. This feature is not available in mql4.
  4. Public libraries to share indicators or strategies with the public to get more ideas from the public. A public library will also save a lot of your time because you can search for the codes you are looking for. Maybe someone else has already written that code. It will save you time.

I will recommend you to learn advanced pinescript instead of old-fashioned mql4.

What will we learn from pinescript Tutorial?

We will learn

  • Syntax
  • Variables
  • Variable operations
  • Conditional statements
  • Functions
  • Drawing
  • Indicators
  • Coding Trading strategies

If you have knowledge of the python programming language then it is a plus point for you and you will learn pinescript easily.

If you are a trader you must learn this language to create custom indicators to save a lot of screen time.

Tradingview Pine script - Introduction | Lesson 1

I will explain everything about pine script and will teach you from basics to advance. Basically, I’m an engineer, a full-time forex trader, and have in-depth knowledge of the python programming language. Pine script is very easy as compared to python.

At the end of this pine script tutorial series, you will be able to code a good indicator or a trading strategy.

Note: All the viewpoints here are for educational purposes only. we are not responsible for any type of loss in forex trading.

Do you want to get success in Trading?

Here's the Roadmap:

1. Learn supply and demand from the cheat sheet here
2. Get access the Supply & Demand Indicator here
3. Understand the fair value gap here
4. Use the set and forget strategy here
5. Follow the risk management plan here

Leave a Comment