Pine Script [OUTDATED V4] Tutorial | Lesson 1 | Introduction: Hello World!

Pine Script Mastery Course:
FREE Pine Script Basics Course:
My Indicators:
Pine Scripters Network (Forum):


Note: I say in the introduction that Pine Script doesn’t allow you to automate your trade executions. This is partly a lie. In future advanced lessons I will explain how you can use Pine Script alerts to send messages to your broker’s API system to automate trading strategies. But this is far outside the scope of beginner lessons, so I thought it best to avoid this topic for the time being. I hope that clears up any confusion you might have if you’ve heard about automated Pine Script strategies 🙂

Want to learn how to code in Pine Script but unsure of where to even start? Fear not! I have you covered.

In this video lesson series I’m going to teach you how to create your own scripts in TradingView’s Pine Script programming language.

Now I’m no expert, but I do have several years of experience in coding using various languages from games development to software development to trading indicators and tools.

So get ready to take your trading to the next level. I’m excited to share my knowledge with the trading community to help you guys enhance your edge and become the best traders you can possibly be!

For more information visit my website where I have a series of text lessons as well as my collection of open-source TradingView indicators:


My Other Indicators:

Visit for more forex and trading psychology tips!

Public Forex Trading Journal:

Best Trading Books:
Best Trading Videos:
Best Charting Platform:
Best Indicators For Forex:


The content covered in this video is NOT investment advice and I am not a financial advisor. The material covered and the resources offered are for educational purposes only. Always do your own research and only execute trades based on your own personal judgment.

#Forex #TradingView #Indicator


  1. hai i have plotsahpe for cci crossover ema, can you show me how to plot below -100 line to zero line. -100 <= 0

  2. The thing with syntax is it's important to learn but as you become experienced, you don't seem to notice it. You eventually are able to read code like it is english where you don't notice the subtle syntax involved. I'm not sure yet if pinescript has functions, but you can look at a function and know instantly what it does even if it's made up of multiple lines of code.

  3. daaaam i was worried that i would have to replay this video over and over again at .25x speed, but you explanations are so good that wont be necessary

  4. Great video thanks so much – I'm looking for a script for a trailing stop loss – I've found a number of them but they only provide alerts. I'm looking for one that actually ends the trade so I can use it un-attended can you help me out or recommend one.

    Thanks in advance. Mike

  5. Question:

    I've been learning Pinescript for a while now in my free time here and there, not quite intermediate. I'm also intermediate level in Java and Python and can make basic web apps with frameworks. My question is: Is it possible to create a client application with a general-purpose language (i.e. an interface with entry fields) that can then be linked to execute the Pine Script equivalent? For example, I'm trying to create a grid-trading backtest strategy in Pine Script but I want to create an app, a user-friendly UI that's executable from my desktop that I can input values (grid interval, capital allocation per grid, elapsed date(s), etc). The application would then run the necessary script in tradingview with those settings. I already have an idea of how to get feedback from the strategies' output with a js-compatible scraper like Selenium + chromedriver, and that same setup can theoretically initiate the scripts, but I don't know if there's a way to remotely change the script code itself to accept new values. I didn't get any hits on Google, probably because there's no easy way to word my question. Gladly accepting input from anyone

  6. Hey Dude, you are GOOD! Excellent instruction. Good on you!
    Will check your website out. Just liked several of your videos and subscribed.
    A couple of questions: You mention that there's no way to link trade execution into Tradingview. But there's a trading panel / window on the current version of Tradingview. And there are some brokers listed there. What is the trading panel used for? While I do invest, trade, and code, I am not familiar with PineScript. Your lessons are definitely helping. Also, I am on a Mac and I find it difficult to change the view (ex: from 1 Yr to 3 Month). Are you using HotKeys? Can you do a lesson just on the Settings, Hot Keys, how to control the view — just a request. And i tried to reach out to Tradingview (for chat support or just finding out about their different subscription offers, but they have no contact info listed), have you run into that problem? Any advice? Thanks again.

  7. I'm really enjoying the video and your style. Great work!

    Just one minor correction for something is completely irrelevant to trading. You mentioned that Shakespeare is written in old english. I know what you mean by that because he wrote in English that is 'old' by today's standards.

    But technically, (and this will surprise a lot of people) Shakespeare is written in 'Early Modern English'. Old English is much much older – from the 1300s – Chaucer's time (ie. The Canterbury Tales). 'Old English' is almost incomprehensible to speakers of modern English. It's literally like a foreign language. You can see an example of this here:

  8. How does one find the pine script on mobile? I have an android.
    Also, if you have whatever code you want in pine script and you put it in on a desktop computer, does that feature show up on mobile?

  9. Sir, I want to code for a candlestick color i.e. if candle's real body is less than 50% of entire range/body of candle then that candle's color should be blue
    Plz help me to do it.

  10. Hi, i try to make a crossing ema strattegy, but i want to buy and sell just exactlly when the crossing ema happen, not in the open or close of the candle. It is anny way to calculate at real time, like( calc_on_every_tick ) the value of each ema and place the order exactlly when the crossing ema happen? Also i want to make it possible to view it and prove it on simulated strategy. Please help me. Thanks.

  11. I wonder what's the reason behind everyone releasing their scripts? I see it all over the website. I thought people would want to keep their trading algorithms personal, but maybe those free ones just set the framework and functions and it's up to the people to come up with their own algorithms? I've seen people sell scripts for TV for a lot of money, so there must be vastly different tiers of scripts available

  12. Thanks for the video! great stuff. I am pulling my hair out – not much left – trying to get a signal to appear when W% crosses 50 line. Can you help me with code to achieve this? Thanks!

  13. OMG! this is what i have been looking for months.To be honest these tuts are really awesome easy and much understandable even for a non coder.Thank you so much for these tuts keep making more! Love from India!!

  14. Best I've seen regarding coding lessons, not only in pine.
    No mumbling or going back-and-forth, only a well planned lesson from a person who remembers what it meant to be new at a something.

  15. how could i find the highest high a set number of bars back.. and keep it as constant until it is breached by the close price? I would then want the highest high to move up with the close to find the new resistance (or reversal level) and then stay constant at that level until it is broken again?

    I don't want the highest high to move like the donchain channel, I just want it to stay "constant" until it is breached.

    Similarly, i would do the same for the bottom band of support or reversal too.

    BUT, I want to resistance and support to move in tandem when they are breached… for e.g.:

    highest high resistance 20 bars back is 4000 and the support is 2000. If the close price goes to 5000, then the support would now be "approximately" 3000 and the resistance would be 5000. The support would move in tandem parallel to the resistance line so it would look like this:

    ….. (dots) = price (plotting close price)

    ___ (bands) = the support and the resistance

    5000 ______________________________

    upper reversal band /.

    4000 ________________________________. ___________________________

    . .. .. .. …. .. /


    bottom reversal band

    caveat: if the two lines move in tandem, then the difference of the price between the new resistance/support might be greater or smaller than a 1000 point difference – due to Pythagoras.

    These bands would just follow the close price as above determining new reversal levels for trends in the ticker.

    additionally, if i could color these lines different colours and get them to swtich positions when breached so it shows you visually when the trend is reversing.

    If you could help me out with that, that would be great!

    Calum, Scotland

Leave a Reply

© 2023 53GB