How to Automate TradingView Strategies With MetaTrader
Today I’m going to introduce you to a powerful little tool called PineConnector.
Every ambitious trader dreams of having an automated system.
The idea of having a money-printing machine running 24/7, never missing any trades, always pouncing on opportunities, always exploiting its edge over the markets is an alluring one to most traders regardless of how successful they are at manual trading.
Personally, I quite enjoy manually trading, and I believe human discretion can be a major advantage when it comes to attacking the markets.
But discretion can also be a trader’s worst enemy if they don’t have an edge, or they don’t have control over themselves and their emotions.
The most powerful thing about automated trading systems, aside from the fact that it can operate 24/7, is that it eliminates the traps that most losing traders fall into.
Computers are dumb. If you want to tell your computer to do something, you need to be extremely clear and concise with the instructions you give it.
And when it comes to automated trading, this is even more true.
To successfully automate a trading system you need to tell it everything – your entry and exit criteria, your desired market conditions, your stops and targets, your position sizing, and anything else that influences the decisions you make to buy or sell.
Once that information is input into the system – it does what you tell it to do, over and over again, with true consistency, without deviation, without second-guessing, without fear or greed, without any consideration whatsoever except to ask – does this action I’m about to make meet the instructions I’ve been given?
Most traders cannot operate that way at all times. Even the best traders in the world cannot operate that way at all times.
Today’s article is not an attempt to convince you that human emotion in trading is a bad thing. As many great trading psychologists have demonstrated, human emotion is an important guidance system for successful traders.
But machines are powerful allies if they are employed properly. And there’s no reason why a successful discretionary trader can’t include an automated system in their arsenal, and certainly no reason why an unsuccessful trader shouldn’t try it.
Automated systems don’t need to replace your manual discretionary trading, but they can be used to supplement it and enhance your yearly returns.
And today, I’m going to explain to you how you can easily turn your TradingView scripts into automated systems.
What Is PineConnector?
PineConnector is an Expert Advisor plugin script created for the MetaTrader trading and charting platform.
I am not a big fan of MetaTrade and i don’t use it for my manual trading and chart analysis because I find it to be clunky and unintuitive. I have never been more frustrated in my trading than the first time I tried to use MetaTrader.
But despite the fact that using MetaTrader feels to me like using Windows 95 with a joystick, it does have a powerful scripting functionality that makes it extremely effective at automating trade management.
The catch is that MQL, the scripting language MetaTrader uses, is far from intuitive to learn.
Even though MQL is a powerful scripting language, it’s not ideal for beginner traders
Which is why I specialize in Pine Script for the TradingView platform.
Pine Script is exceptionally easy to learn, easy to code and runs on the TradingView servers so that you don’t need any fancy hardware or software to get up and running.
I would encourage everyone to learn som basic coding in Pine Script.
But again, there’s always a catch.
MQL is a powerful language, but is far more complex, runs in the clunky MetaTrader platform and is difficult to learn to code.
Whereas Pine Script is a simple language, runs in the sleek cloud-based TradingView platform, is easy to learn, but cannot be used to automate trade management or trade execution.
At least, not on its own.
This is where PineConnector comes into play.
The PineConnector Expert Advisor is a script that runs in MetaTrader and “listens” for your TradingView alerts. By putting a link to PineConnector’s webhook URL into your TradingView alerts, you can send commands to MetaTrader to manage your trades.
It’s as simple as copy & pasting a link into a textbox!
Don’t worry if you’re new to all this and that last paragraph was pure gibberish to you – it’s nowhere near as complicated or hard as it sounds.
There are plenty of official guides written by Alex (the creator of PineConnector) that go into great detail about how to set it up and troubleshoot any problems you might encounter.
I’ve even written several strategy scripts for TradingView which include PineConnector automation inbuilt right into the code so that all you need to do is tell the script how much money to risk per trade, and it will do the rest!
Pros of PineConnector
Here’s a list of what I consider to be the stand-out positive features of PineConnector:
– It’s cheap.
At $14.90 per month, PineConnector is the cheapest TradingView bridge service on the internet (at least that I’ve come across in all of my research).
– It works through any broker that supports MT4 or MT5
This means that so long as your broker supports either MT4 or MT5, you can use PineConnector to automate your TradingView scripts.
The PineConnector script has two versions: one for MT4 and one for MT5. They both behave identically in terms of how you send commands, which opens up a whole world of different brokers which are compatible with this service.
And last but not least:
– It includes inbuilt position sizing
PineConnector allows you to customize your position sizing based on either lot sizes or a percentage of your account balance.
Most profitable forex traders use some form of risk based on a percentage of their account balance.
PineConnector makes this easy to do – you simply tell it to risk “1” percent of your account (or whatever number you choose), and it will calculate the appropriate
Cons of PineConnector
When it comes to bridging two languages in the way that PineConnector bridges Pine Script to MQL, there are always going to be limitations and drawbacks.
Here are the main negative features of PineConnector I’ve found to be a hinderance during my time using it:
– It could be tricky to set up if you’re inexperienced
This is only true if you’ve never used MetaTrader before or you’ve never installed or used an Expert Advisor.
Truthfully, it’s not any more difficult to set up than any other automation programs, but the steps are different, and when it comes to the EA’s inbuilt settings there are more things that can go wrong.
The good news is that Alex has written an extensive guide on how to install and set up PineConnector – both a MetaTrader 4 Guide and a MetaTrader 5 Guide.
He also has an extensive error guide, so that if something does go wrong when you’re using PineConnector, you can get to the bottom of what’s going on quickly and rectify it.
And if you run into any problems you can’t solve, just shoot the support team at PineConnector a message and someone will get back to you ASAP – usually Alex personally.
– It can’t talk back to your script
This is a problem with all TradingView 3rd party APIs and alert bridges, but it’s important to mention.
Unlike an expert advisor or automated Python script for example, TradingView scripts can only send information – they can’t receive it.
So you’re essentially dealing with one-way communication.
Your TradingView script can tell PineConnector when to enter a trade, when to exit a trade, when to modify a trade – but PineConnector can’t tell TradingView that your trade was stopped out by spread fluctuation, or that your trade wasn’t executed due to inadequate margin or other such feedback.
This isn’t a huge problem, but it’s a limitation that can make certain strategies impossible to automate in this manner. For example, it makes it impossible to tell PineConnector to close a specific position, so if you have multiple trades open on the same market then you can’t manage them individually.
PineConnector works best with simple strategies – which is fine with me, as I’m a huge fan of simplicity and elegance over complexity anyway.
– It lacks some features
The final drawback for PineConnector currently is that it lacks some features in regards to specific trade management techniques.
As of writing this article, PineConnector is still a work-in-progress, and although it is at a stage where it’s possible to automate the most important aspects of your trade execution and management, there are a few things it can’t do yet.
For example, I can’t currently use commands to update my stop loss and move it after it’s been placed, which makes it impossible to make an ATR-based trailing stop, and I can’t change my profit target.
You can trail your stop loss using a pip-based automatic trailing command, but you can’t manage your stop loss through your Pine Code – yet.
These missing features will almost certainly be added in over time as Alex continues to develop the script and service, and he is always open to suggestions and has already added a few features I’ve personally requested.
But it’s important to mention this fact so that you understand the current limitations of PineConnector before getting involved with it.
How to Install & Use PineConnector
I’m not going to write out a full guide to installing and using PineConnector as Alex has already written some fantastic guides for everything you could ever need.
Here is a list of the official PineConnector guides:
Summary
I don’t really know what else to say except that I really think you ought to check this thing out.
With a 7 day free trial, you have nothing to lose by experimenting with PineConnector.
I’d suggest starting with one of my strategy scripts which are designed with PineConnector in mind, and have inbuilt automation ready to go – all you need to do is set up MetaTrader and input the correct settings into both the PineConnector Expert Advisor and your script settings.
Keep in mind that automated trading is not the magic solution for everyone. It’s not easy to do, and it’s not fail-proof. Plenty can go wrong when you’re playing with automation.
But for those who are interested and passionate about trading and technology, you will find the quest to automate your strategies an exciting and intellectually stimulating one.
Make sure that you’re aware of all the risks before you embark on this journey, and as always – never risk more than you are willing and can afford to lose.
Full disclosure: any links to PineConnector in this article are affiliate links and if you make a purchase I receive a percentage of the sale (at no extra cost to you), but I never promote a product that I don’t personally use and trust. The only affiliate programs I’m associated with as of writing this article are TradingView and PineConnector – and I use them all regularly.