Why Learn Pine Script?

Pine Script Basics Course Pine Script Mastery Course

…And what is Pine Script?

When I first began trading I struggled heavily with two things.

Discipline, and consistency.

I lacked discipline, so I was inconsistent in my approach to trading. 

The reason I lacked discipline is because I lacked confidence in what I was doing. I had no idea if what I was doing was going to work. 

Everything I did in my trading was based on subjective whims and emotion. I had no system, everything I did was essentially random – and so my results were mostly random.

But then I discovered backtesting and rules-based strategies, and my trading experience changed forever.

I slowly went from a consistent loser to consistently breaking even, and from there to my first 4 profitable months in a row.

Since then I haven’t looked back. 

And once I discovered Pine Script, everything changed again.

Pine Script is TradingView’s proprietary scripting language native to the browser-based TradingView charting platform. It’s completely free to use, mostly open source, and you don’t need to be a rocket scientist to work with it.

Pine Script allows you to objectively define your trading setups and process using computer code so that there is zero question about whether or not you have a valid and profitable trading opportunity.

You can either detect your specific set of rules for a valid trading setup with edge and then backtest that information manually, or you can even write a script that will automatically backtest that data for you over hundreds of trades in a matter of seconds.

Using scripts to identify profitable trading opportunities involves no subjectivity, no emotion, no guessing, no uncertainty.

Your backtesting results don’t lie, because computer code doesn’t lie.

Obviously past results are not indicative of future performance, it’s difficult to emulate position sizing and accurate drawdown stats, and live market conditions may be slightly different due to slippage and spread and commission costs etc… but your script never lies

Like a mechanical machine, it does the same thing over and over again without deviation. And if that repetitive analysis produces a trading strategy that wins more than it loses over a large sample size of trades and over a long period of time, then you have a profitable strategy

All you need to do is execute it.

Discipline still plays a role. If you lack discipline you may not be able to execute your coded strategy consistently. 

But if you can trust the strategy – which isn’t hard to do if your backtesting results prove it works – and you can execute consistently, then you’ll get consistent results.

And if your strategy rules have been objectively defined, written in code, tested over historical data to prove it works, and you have the self-discipline and self-confidence to execute it consistently… then it stands to reason that you will get consistently profitable results – which is what we all aspire for as traders.



What is Pine Script
& What Can It Do?

Before I break down the extensive list of good reasons to learn Pine Script, I should first take a moment to explain specifically what it is.

Pine Script is a simple programming language custom-tailored and designed exclusively for the TradingView charting platform.

It can be written and worked with straight from your chart window using the Pine Editor – an advanced web-based coding editor and integrated development environment that includes all the tools you’d ever need to write your ultimate script – right there for free in your web browser.

The Pine Script Editor is as easy to use as it is good-looking

Pine Script runs on the TradingView servers – so once you add the script to your chart and set your alerts you can turn off your computer and the script will continue to run on their system indefinitely with zero downtime.

I’ve been using their alert functionality for over 4 years now without a single missed signal across multiple markets & intraday timeframes, so their system stability and uptime is impeccable – which is important for serious traders.

It’s lightweight, easy to learn, extremely quick to write, even quicker to compile and run on your charts, and it allows you to analyze price data easily, simply, and efficiently.

You can then use your script and analyzed data to do one of several things:

  • You can draw that analysis information onto your chart (eg. a trading signal including price action patterns and indicator condition detection, your stop loss and your profit target in pips, points or price – all visible on your chart for fast & easy order execution).

  • You can use scripts to trigger alerts which either create a popup window on your chart, play a sound to notify you, send you an email or SMS, send a push notification to your phone, or do all of these at once – so you can stay on top of the markets at all times without needing to stare at screens all day or even without your computer turned on.

  • You can automatically backtest strategy ideas over dozens of markets, hundreds of trades and decades of price data across multiple timeframes and with multiple input parameters in a matter of minutes. This helps you to identify and optimize potentially profitable (or unprofitable) strategies quickly and easily.

  • You can create backtesting aids & tools. This is my personal favorite way to use Pine Script. I prefer to manually confirm that my automated backtesting results are accurate, and there are some strategies out there that cannot be fully automated in the backtesting process. But you can use Pine Script to create scripts that help make the manual backtesting process dramatically faster and more efficient – and about 90% of my published scripts are intended for this purpose.

  • You can modify existing indicators to purpose-fit your own trading style or technical analysis preferences. For example you can modify the RSI indicator to change the background color of your chart when overbought & oversold conditions are met, you can make a moving average change color based on whether price is above or below it, or you can make a Stochastic indicator calculate its information based on RSI data. The possibilities are almost limitless.

  • You can even use webhooks and email alerts to place, exit or manage trading positions automatically through 3rd party services like AutoView – a browser plugin which detects your alerts and automatically manages your trades through your forex or crypto brokerage API. This is advanced stuff not suited for most retail traders and requires its own blog post entirely to do its explanation justice, but it’s worth mentioning!

  • And last but not least – if you develop a profitable trading strategy or custom indicator that is highly valuable and useful to other traders, you can even sell your scripts to generate a side-income from your rare and specialized skill as a trader and coder. I’ve done this with my Ultimate Pullback Indicator script.


Backtesting with Pine Script

One of the biggest attractions to Pine Script for most traders is the ability to automatically backtest strategy ideas with TradingView’s Strategy Tester.

TradingView’s Strategy Tester shows all the analytical data you need

There have been several occasions where I suddenly thought of a simple trading strategy concept (often first thing after waking up), jumped out of bed in my pyjamas, wrote a complete script within 20 minutes before breakfast, and (after a day or two of taking the time to manually confirm the results) I had a new profitable strategy to add to my portfolio.

Of course you could do this without a script – but having that rapid and objective confirmation that the strategy idea shows true potential by having a script automatically backtest it over hundreds if not thousands of trades in a matter of minutes dramatically speeds up the strategy development process.

Not just by identifying promising ideas – but also by quickly allowing me to throw out dud ideas.

Perhaps the most useful feature of TradingView’s automatic backtester is not necessarily finding profitable strategies – but quickly identifying strategies which are not worth the time of pursuing.

Before mastering Pine Script I wasted hundreds of hours manually backtesting strategy ideas that were in hindsight a waste of time from the start – whereas now that I have a proficient grasp on Pine Script I can eliminate that time wastage almost altogether.

But with all that said, it’s important to mention that even though you can automatically backtest a strategy through TradingView’s backtester system, manual backtesting is still advised.

Automatic backtesting should not be treated as a shortcut to hard work. Trading efficiently is rewarded in the markets, but being lazy is not. It’s important (and often difficult) to determine the difference.

Traders who take shortcuts to due diligence are eventually punished by the markets without exception – and usually harshly.

The backtester has limitations that must be taken into consideration – such as slippage, commission costs, liquidity, spread, and other factors that might not be obvious without manually observing how your mock trades are executed by TradingView.

The way I personally use the TradingView backtester is to efficiently vet and curate potentially profitable strategy ideas, and then I take the time to manually backtest the most promising markets, timeframes and strategy rules to confirm that the strategy indeed has an edge over the markets.

Most of my scripts are not actually strategy scripts, but backtesting aids that help to significantly speed up the manual backtesting process.

After all, there are many strategies out there that are not suited to automatic backtesting such as ones that require multiple timeframe analysis or degrees of subjectivity in your analysis like identifying support & resistance zones.

But in the cases where you cannot write a fully automated backtesting script for a given strategy, or you want to manually confirm your automated results – you can cut your manual backtesting time exponentially by employing good custom-made tools written in Pine Script.

And many of these scripts only require a few dozen lines of code!

If you need help learning how to appropriately and properly apply the backtesting process in your own trading, check out more of my resources on the subject over at backtestingfx.com.

And if you want to learn how to employ the Pine Script language properly then check out my free Basics Course or YouTube Channel.



How to Learn Pine Script
(& Why You Should Learn It From Me)

Now that you understand what Pine Script is and how valuable it is to learn it, the next question is – where do you learn it? And who can you trust to teach it to you?

Well, here’s where I shamelessly plug my talents and services.

I’ve been a programmer for over 15 years.

I started out playing around with computer games in my teenage years using high-level object-oriented languages like Java – creating cheats at first, and then progressing to trying to copy entire existing games while I learned the craft, and then eventually creating my own online games from scratch.

Ironically, one of the very first projects I pursued as a teenager was automating boring repetitive tasks in an online computer game I played called “RuneScape” – one of the original MMORPGs with millions of players.

In that game you had to click a lot to get things done, and there were certain boring activities that didn’t interest me that I had to do in order to progress at the game – so I spent hundreds of hours in my bedroom learning how to code and writing scripts to automate those processes.

Those scripts became quite popular, and over time I developed a reputation in the underground RuneScape cheating community as a kid who knew how to write code that made a lot of other (cheating) players’ lives easier.

It’s funny how some things in life repeat in cycles. Now I do exactly the same thing, except for adult traders instead of kid gamers.

Anyway, after I received a cease and desist letter and a threat of expedition to a foreign country for trial over copyright infringement from the creators of RuneScape back in 2007 – I quit dabbling on legally-dubious pet projects in my bedroom, graduated high-school and went on to university.

I studied games programming and web design there for nearly 4 years, excelling at my chosen classes.

But in the end I dropped out and decided not to pursue programming as a career because quite frankly I hated web design, I didn’t enjoy staring at screens all day every day, and even though I enjoyed making games and the challenge and puzzle of coding, I didn’t want to work for someone else as a coder-for-hire.

Deep down I really wanted to be a lone wolf entrepreneur, and I knew that majorly successful games projects required large teams and budgets and lots of resources. I could see that what was once a passion of creativity was quickly becoming a potentially mundane 9-5 like any other job.

Plus I had more passionate aspirations to be a musician, and had been offered to join a local punk rock band that I was a big fan of at the time.

So I dropped out of coding school and went to music school instead. I enrolled into the School of Audio Engineering and began playing pubs and bars around Queensland and New South Wales with my band for a number of years.

I thought maybe I could become a music producer, create my own record label and run my own business, and so I began pursuing that – but again, life had different plans for me.

Long story short, a decade after dropping out of university and after afflicting myself with a severe chronic injury that prevented me from playing instruments, I was forced to abandon my career as a musician – and I became a trader.

I’ve been trading since 2016, going on five years now. And it was around 2017 that I began researching Pine Script and reignited my interest in programming.

Although I have a strong passion for trading, I still don’t enjoy spending the majority of my time staring at screens.

Plus my injury means that it physically hurts me to spend too much time working on a computer, so I began thinking of ways to make my work more efficient and reduce how much work I had to do.

So when I discovered Pine Script and realized how much screentime I could save myself by writing scripts to detect my trading setups for me and accelerate my backtesting process, I dove in head-first and became obsessed with mastering the Pine Script language.

Pine Script is an extraordinarily simple (but powerful) language, so it didn’t take me long to get a good grasp on it given that I’ve spent the last 15+ years regularly working on programming hobby projects in my spare time for fun.

And now, four years later, I’m sitting here at a local restaurant having a beer on a quiet rainy Thursday afternoon while I write this article – and my scripts are watching the markets for me.


I have several strategies I trade, and all of them are either fully detected by my scripts or they are partly detected by my scripts.

I get a push notification sent to my phone whenever a valid trading setup or condition is confirmed (or an exit reason is detected), and it takes me a matter of seconds to place or manage the trade.

Of course I still have three monitors in my home office (every serious trader needs a wall of screens!), and I spend a large part of my day in there working. But most of that time is spent working on my blog, or my YouTube channel, or my educational courses – rather than staring at price action.

In other words, staring at charts all day is now optional. And while I still do it from time to time if I’m trading a 15-minute timeframe or lower, when I get sick of it or when markets are slow, I can leave my office without the fear of missing a profitable trading opportunity. And it’s all thanks to Pine Script.

I’m not going to get into the reasons why I can’t fully automate my trading process to the point where I don’t need to manually manage my trades, because that’s an entire blog post of its own.

But personally, I prefer to manually manage my trades anyway.

I’m essentially a trading cyborg. My scripts do all the heavy lifting for me, and even though I’m still the captain of the ship, all I need to do is wait for my scripts to alert me to a profitable trading opportunity.

Then I click some buttons, do what my scripts and strategy rules tell me to do, and go on with my day. And I can trust my scripts with confidence, because I wrote them, and I’ve taken the time and put in the work to verify their accuracy.

That’s how I like to operate. I’m a semi-auto trader, and that gives me the benefits of both worlds.

And if you’d like to become a semi-auto trader too, and free yourself from screen slavery, then let me help you significantly speed up your learning process by teaching you what I’ve already learned.

I’ve read hundreds of pages of tedious Pine Script documentation and spent hundreds of hours smashing my head against the wall trying to work out some of the most frustrating challenges you can encounter in this language – and now that I’ve mastered Pine Script and collated the majority of my knowledge into a handful of courses, you don’t have to do any of that.

With my programming expertise combined with the fact that I’m a consistently profitable trader with experience in every major market you can trade, I think I’m uniquely positioned to help traders conquer this extremely valuable coding language.

Head over to www.pinescriptmastery.com to see my range of courses, some of which are completely free – or visit my YouTube channel where I upload free Pine Script lessons regularly.

I also have a range of blog posts teaching the basics of Pine Script, and you can access all of my open source scripts right here on this website on My Indicators page.

Or if you don’t trust me to teach it to you yet then you can of course find a wealth of free information out there about Pine Script by just googling it. But good luck curating the good stuff from the bad – I know from personal experience how difficult that can be.

So I would recommend that you at least take the time to check out my Free Basics Course before you go elsewhere so that you can get started on the right foot. It’s free, so it’s risk-free. You have nothing to lose and everything to gain by going through that material.

Pine Script is a passion of mine and writing scripts is a labor of love for me, just like trading.

And while you can’t use Pine Script to shortcut all the hard work profitable trading requires, you can use it to make your trading process much more efficient.

It’s changed my trading significantly for the better, and I’ve spent hundreds of hours reading the documentation and practicing with the language – so let me help to shorten your learning process by passing on to you everything I’ve learned over the years.

We all became traders to be free. Financially free. Boss-free. Stress-free.

Learn Pine Script – and secure your own freedom of time, too.


Pine Script Basics Course Pine Script Mastery Course

Free Premium Charts!

0 0 vote
Article Rating
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Harvey Utech
Harvey Utech
2 years ago

Is using third party applications like Autoview covered in your free course? Master course?
Also why such a big jump in price from Free to Master? Could not the latter be priced in smaller increments?
Thanks—

suleyman ozudogru
suleyman ozudogru
2 years ago

I follow carefully, Best regard from Turkey(Turkiye)