How to Automate TRADINGVIEW SCRIPTS through MetaTrader • PineConnector Guide (Part 1)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi traders and welcome to my pine connector beginner guide first things first what is pine connector pine connector is an expert advisor script which was recently developed for the metatrader platform and it allows you to execute trades automatically based on trading view alerts this allows you to fully automate trading view scripts and strategies written in pinescript as you know by now if you've watched any of my pine script lessons pinescript is an incredibly easy and simple language to learn at least compared to python or mql or other higher level languages that are commonly used to automate trading scripts and if you're a subscriber to my channel which you should be if you want to enhance your edge over the markets through scripting then you know that i recently finished an entire series demonstrating how to use the auto view plugin for the chrome browser which does exactly the same thing as pine connector the main differences with pine connector is that it's cheaper than autoview nearly half the price it runs in the popular advanced metatrader trading platform which most brokers offer support for it's more powerful than autoview at least for forex traders the reason is more powerful is because metatrader scripts can read your account balance and various other account details and open position information where auto view does not for example if you want to open a trade with a position size and risk equating to just one percent of your account balance achieving this in order view is far more difficult as you need to manually calculate your position size in your pine scripts pine connector on the other hand can achieve this with a single alert parameter that specifies how many percentage points to risk of your account balance you just add the parameter to your alert message and pine connector calculates your position size for crypto and stock traders this may not be applicable to your trading style but for forex traders this is an industry standard way of operating in the markets by using pine connector you can always be sure that your forex position size is appropriate when executing automated strategies and as any experienced trader knows having a consistent position size is paramount to maintaining consistent results and plays a massive role in your edge over the markets there's always a trade-off when automating pinescript code the benefit of automating panscript code is that pinescript code is extremely easy to write and it's an easy language to learn the limitations of pine script on the other hand when it comes to automating strategies is too long to list but pine connector bridges that gap significantly and as far as i can tell and all the research i've done when it comes to automating pine script strategies on the forex markets pine connector is the best solution out there and in this video series i'm going to introduce you to pine connector and show you how to get started today's video focuses on getting the platform set up starting your seven day free trial and executing your first test trade on a demo account you can find a link in the video description to the pine connector website to sign up and create your account and in future videos i'll cover the pine connector alert commands and syntax in great detail as well as how to automate your trading view scripts and send the relevant alerts within your pine code and finally i'll show you how to set up metatrader on a virtual private server so that you can have your automated scripts running 24 7 with as little down time as possible welcome to the most comprehensive guide to pine connector on the internet let's get started so here we are on the pine connector home page the very first thing you need to do obviously is create your account so to do that come up here and click on login and then click on create account you need to fill out these details and then log into your account once you've signed into your account this is the page you'll be taken to so this number here is your license id and you will need this in order to initiate your trial your seven day free trial and you'll also need it if you purchase access to this expert advisor in order to validate your account on metatrader so once you've logged in you have two options you can either download the metatrader4 expert advisor or the metatrader 5 expert advisor both of these expert advisor scripts behave pretty much identically so it doesn't matter which one you pick as long as you pick the one that's compatible with your version of metatrader so for me personally my main broker is oanda and they only support metatrader4 as of recording this video so today's video is going to show you how to set up the metatrader 4 version but the steps should be pretty similar for the metatrader 5 version and if you get stuck on any of the steps that i show you today make sure to come to this webpage and click on the setup guide relevant to whichever version you're trying to set up so if i open this in a new tab you can see that the pine connector team have written out a list of instructions step by step on what you need to do in order to get this expert advisor set up and running in today's video i'm going to take you through each of these steps for metatrader metatrader4 and then we're going to test a command to make sure everything works and in the next video i'll show you the various alert commands and syntax that we have to work with so let me go back to my main account page and i'm going to click on download mt4 now it doesn't matter where you download this just so long as you remember where you put it so that we can copy it into the meta trader directory later so i'm going to click save here and just save it to my downloads folder so on this computer i do not have metatrader setup currently so i need to go and download the metatrader platform now this ea should work with any version of metatrader4 whether it be the vanilla version or whichever version your broker gives you to download i'm going to go to the oanda website log into my account and then download their version of metatrader 4. if you're familiar with metatrader and you've used it before you might want to skip ahead in this video to where i install the pi connector expert advisor but for those of you who are new to metatrader or haven't used it before the next few minutes we'll show you how to download metatrader create an account and log in to your broker there will be timestamps in the video description to help you skip ahead if you need to so here i am on the oanda account homepage to download the oanda version of metatrader4 i just need to click on this link here so i'm going to click on that and i'm going to save it into my downloads folder now that i have the installation file i just need to click on this little drop down box and click open and i'm going to install metatrader just into the default directory now i'm going to click finish and we can close this page we don't need to make a metatrader account so the next thing we need to do if you haven't already is create a trader for compatible sub account at least that's what i need to do through my broker oanda so to do that i have switched to my demo account because i want to practice these commands on my demo account before i move to my live account and to create a compatible account i need to click on this add sub account link here now just ignore this primary account with 89 quadrillion million dollars in it that was an account i created for my girlfriend's uh little nephew to play around with he did quite well to be honest he made a few hundred million dollars trading corn which is uh pretty impressive for a seven-year-old anyway i've already got a metatrader account set up and if i want to log into metatrader this is the information i need to pay attention to or at least my metatrader login and server if you don't have this account and you're using awanda then to create a metatrader4 account all you need to do is click on add new subaccount and then select metatrader4 here and then once you've done that you should have this information here when you click on your relevant account and now this is the info i need to log in to metatrader so let me open up metatrader here it is click on that now if i go back to my owander account my server is oandademo1 and i need to copy this account login number so awanda demo1 will be this server here this practice server if i click next and then i click existing trade account paste in my login number and then type in my password here my account is now logged in and just to verify that i'm going to come up and click on new order and just see if i have the option to and i do so i am now so i am now logged in to my account you'll have to ignore all these silly sounds that metatrader makes it's quite annoying i'm sure you can turn it off in the settings but i'll leave it as it is for now and we'll just move on to the next step in setting up a pi connector which is opening up your data folder so the quickest way to do this is just click file and then click on open data folder and here it is now we need to open up the mql4 folder just double click on that and then we need to open up our experts folder at the top here any of you who have used expert advisors before knows how this works but for those of you who don't we need to copy in the pi connector expert advisor file or script into this folder so for me i downloaded my file to my downloads folder so i'm going to click on that i need to copy this file or cut this file right click cut and click back and i'm going to paste that file into this folder here and now the expert advisor script is installed all we have to do now is close this folder close metatrader and then reopen metatrader so that it can load the script that we just added so i'm going to relaunch metatrader and we're back in if i click on this plus symbol under expert advisors we should see the pan connector script installed so the next step is to adjust some of the metatrader default settings to enable the permissions that this script needs in order to do that we need to go up to tools here and click on options or hit control o next we need to click on the expert advisors tab and then enable or allow dll imports it says potentially dangerous enable only for trusted applications pine connector is a trusted application it's a legitimate script and we're on a demo account anyway so it's perfectly safe to click allow on this option while we're here we should also click allow automated trading which will allow party connector to trade on our behalf when the time comes and i'm going to untick these two options here now we can click ok and the next step is to attach pi connector to a chart it can be any chart it doesn't need to be the chart or the market that you want to trade as long as this script is attached to any chart in the platform then when we send our alerts to pine connector to the pine connector web hook our script will receive that alert and we'll trade any market that we tell it to the only requirement is that we leave metatrader running on our computer now that could be a problem for some of you but don't worry at the end of this series i'll show you how to set up a free virtual private server to run this 24 7 on a virtual server i've already created a lesson on how to do that for order view the link will be in the video description and should be popping up on the top right hand corner of your screen right now the steps are extremely similar to that video if you want to set up a virtual private server to run metatrader but we'll come back to that later first of all let's just get this script working so the next step is to attach pine connector to a chart if this window is not open for you press ctrl n to open it up now i'm just going to close three of these charts and maximize this middle one and i'm going to right click this and click attach to a chart the next step is to come to the common tab make sure allow dll imports is selected and make sure that allow live trading is enabled the next step is to click on inputs and now we need to paste our license id into this value column so to get your license id go back to the pi connector account web page which is this page here and we need to copy this number here so you can click on that or just copy the text go back to metatrader and then paste that number in here now we just click ok and that should add the script to the chart now if the script was successfully added to your chart and you were successfully authorized to use the script then you should see in your top left corner your free trial expiry date if you see this text up here then you have successfully installed and added the script to your metatrader platform and that's pretty much it all we have left to do is test the command make sure that the script is working and then we'll wrap up this video and i'll come back in the next video and we'll go over all of the command syntax that we have to work with when using this script all right so before we set a test alert on the trading view platform we need to adjust a few settings in the pi connector expert advisor so to do that i'm going to right click on my chart come down to expert advisors and click properties now here is our pi connector input settings i want to adjust a couple of these i want my take profit and stop loss to be based on price so i'm going to double click on this setting here click on the drop down box and change this to tp and sl based on price if you leave this on pips and you send your alert with a whole number for your take profit or stop loss then the script will treat that number as pips but if you want to set it based on price you need to change your setting here in the pi connector interface the next setting is our volume type i'm going to leave mine on a percentage of my account balance but you could change this to a specified volume or lot size if you wanted to depending on your strategy you might need to change this but it's generally considered best practice in trading to base your position size as a percentage of your account balance rather than some arbitrary lot size unless of course you're using a complex money management technique but for today i'm going to leave mine on percentage of balance i don't need to worry about pyramiding this just means if it's set to true then the pi connector script can open more than one trade in a given direction and hedging means that you can open multiple trades in multiple directions i'm going to leave that with the default setting of false and i'm going to leave pyramiding on for now so now i need to click ok so now let's jump over to the trading view charting platform and we can set up a test alert i'm just going to scroll to a blank chart here we go and actually let's open up euro dollar since that is the market we're going to send a test command to so now to send a test alert all we need to do is right click on our chart and click add alert now we want this alert to be guaranteed to trigger since it's a test command so to do that we're going to click on the condition here and change this to greater than and then just set the value to zero so that will guarantee that this alert fires as soon as it's created next up we don't need to be notified about this alert unless you want to be and i don't want it playing any sounds when it fires so the first thing we need to do to make sure that this alert will fire is input the webhook url to pine connector so to do that enable the webhook url textbox and you can see i've already got mine saved here but i'll show you where to go and get this url if you need to in the future if you go to your pi connector account and click on configure alerts to our server alerts guide here and you scroll down to number two here step number two you can see the webhook url right here so just copy this webhook url and paste that into this webhook url textbox in your alert interface and now whenever this alert triggers whatever we put in our message will be sent to this webhook url and then pi connector will relay this information to metatrader so if you want more information on how to set up your alerts through point connector make sure to go through this alerts setup guide but in today's video i'm going to walk you through this first section here so the first thing we need to do is get the right symbol ticker id from metatrader if the symbol you want to trade isn't listed in this list here press ctrl u and then click on these groups to locate the instrument you'd like to trade these groups will look different depending on your broker oanda have kindly named these groups in a manner that's extremely easy to understand and that's sarcasm obviously but if the symbol you want to trade is in gray for example let's say i wanted to trade the aussie 200 asx 200 i need to double click on this instrument to turn it yellow and then this is the ticket id that i would need to send to pine connector in my alert message to trade it so make sure to come into your symbols list and activate the symbols you want to trade make sure that the symbols are yellow the ones that you want to trade through pine connector it's going to be different based on whatever platform you're using or whatever broker you're using it's not as simple as just sending the market you want to trade if i open up my metatrader account here and make sure to pull out this window a little bit further so that you can read the entire ticker id you can see here that all of my markets end with a dash 2. so if i want to send a command to open a trade on eurodollar i need to add dash 2 to the end of my ticker id it's a little bit annoying i know especially when it comes to sending these commands based on your pine script code but when we get to the lesson where i show you how to send commands to pan connector through your pine script code i'll show you a solution to this issue but for now just remember that when we're sending our test command i need to write out my ticker id as euro dollar dash 2. so before we write out our command let's go to the alert setup and just read the example message here so you can see that the parameters of our command or our alert syntax is separated by commas and the first parameter we need to send to pi connector is our license id so if i come up to my account here scroll to the top that's this number here again so if i right click this and click copy and we go back to trading view i can paste that id in here hit comma and now the next parameter is which direction i want to trade in so you can see here we have our license id buy or sell if we write cell in here then that will sell this market short but today i want to buy this market next up we need our ticker id and then we can specify our stop loss take profit and risk etc so to specify the market i want to trade remember that we need to put in our ticker id remember that the ticker id ended with a dash two so i need to write it out like this this will send a buy command to the euro dollar market on metatrader next up we need to specify our risk remember that we set our risk to a percentage of our account balance in the pine connector settings so i can use any number here one would be one percent um two would be two percent so let's go with two percent for today's example next up i'm also going to specify a stop-loss price and a take profit price now if you had set up your pine connector settings to be based on pips then you could use a whole number here in order to uh specify your stop loss and pips so 25 for example would set up a 25 pip stop loss below our entry in the case of a buy order but for today we're dealing with price so i'm gonna write in here let's just go with 1.184 to keep it simple so when this command gets executed we will have a stop loss placed right here and for our take profit let's set that to 1.194 just to keep today's example as simple as possible so now this should be all we need in order to execute a test trade on euro dollar so when i click create this alert should fire instantaneously and open a buy order at market on euro dollar with our two percent risk based on our stop-loss price so let's click create and then jump over to metatrader and see what happens there we go it just fired off and here we have our euro dollar trade opened so you can see that our trade was opened at 1.1909 our stop loss is at 1.184 and our take profit is at 1.194 and our position size is 0.21 of a lot or around 21 000 units so there we have it we've successfully set up pi connector and fired our first test trade so if you want to see your orders in real time just right click on the symbol we're trading and click chart window and you can see where our buy order was executed and our take profit and stop loss so that will do it for today's introduction video in the next video i will go over the various commands we have to work with with pi connector and in the video after that we'll get our hands dirty with some pine script code and start sending these commands to metatrader from within our scripts the same way we did with autoview in my order view series if you've watched any of those lessons now the concepts here between autoview and pine connector are very similar the main difference is obviously we're working with metatrader here and the coolest difference in my opinion is that we can set our risk as a percentage of our account balance through metatrader which takes into account our actual account balance as opposed to autoview where we need to artificially calculate our position size in pinescript since autoview doesn't allow you to set your position size based on a percentage of your account balance the other cool thing is that pine connector is quite a bit cheaper than auto view nearly half the price so not only is pine connector more powerful than autoview at least when it comes to forex trading it is also significantly cheaper and now if you decide that you like pine connector and you want to subscribe to the platform if you also want to support my youtube channel there'll be an affiliate link in the video description that you can use to create your account over here on pine connector and i will get a commission based on your purchase at no extra cost to you so if you do use my affiliate link i am extremely grateful and even if you don't thanks for watching i'm really appreciative of your time and i hope today's video at least helped you get started with this awesome service anyway that'll do it for today's video i need to go and manage my own trades thanks for watching take care and i will see you very soon in the next lesson you
Info
Channel: The Art of Trading
Views: 7,674
Rating: undefined out of 5
Keywords: tradingview, pine script, tradingview indicators, forex algo, stock algo, trading algo, trading algorithm, how to create trading strategies, trading scripts, forex scripts, crypto scripts, stock scripts, bitcoin scripts, trading signals, forex signals, crypto signals, stock signals, detect trading setups, pine script mastery, pine script mastery course, how to use tradingview, how to use pine script, scripting, ema, crypto algo, pineconnector, pine, connector
Id: Ts5lBAxGHW0
Channel Id: undefined
Length: 23min 38sec (1418 seconds)
Published: Thu Jul 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.