Introduction & Setup | Trading with Python #0

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to the first video of training with python series in this video we will have an introduction to mandatory five integration what you will learn in this video is how to stop python to start writing your own algorithm programs then we will look at military five how to open a training account with a broker company and lastly i will show you how to write python programs in meta editor which is the mt5 ide to download python go to python.org downloads and click on the download button make sure to add python to path and then click install now in the command prompt after installation you can type pip install metatrader5 to install the military 5 library also you will need a trading platform to trade on and i'm affiliated with icmarkets.com who offers live and free demo accounts on the military five platform you can check the link to this broker in the descriptions below after downloading the monetary five platform and receiving login creations from your broker let's write our first python script please make sure that algo trading is enabled and let's open the id by clicking on this icon this is the meta editor where you can write your code and to create our first python script let's click on new select python script and here we will choose a name for a python script let's choose hello world for now we'll only need the magi5 library and here we already have a layout for our code here we have our mantra file library imported already and what this code does is it initializes our metrofile platform that means that the platform is running so now we can type our code here and what we will type is print hello world let's save the script and try to run it in our platform after clicking refresh on in the navigator your python script should appear and if we now drag the script onto the chart the script should have run and in the experts tab we see hello world of course as algo traders we don't only want to print hello statements to a terminal but we want to place an actual trainer market so i've prepared a script to open the trade and the script name is open trade let's see what it looks like so i've defined the symbol in your sd and what i want to do is buy one lot on the euro us dollar i've defined the lot size 1.0 i want to buy for the current market price and we buy for the ask price here and we're defining the point values which is the smallest digit on the usd this is important to define things such as deviation stop loss take profit as they take the minimum increment price into account then i'm creating a request dictionary that will be passed to a function that will send it to the meta trader to process it on the live market and this request has keys such as action here we can define what kind of action we want to perform in this case we want to create a trade action here we specify a symbol which is usd then we specified type of order and we want to have a buy order here for which price the price is the current ask price the stop loss is set to 100 points below the buying price and the take profit is set to 100 points above the buying price and we see that the point values are important because they determine the decimal value of the stop loss and take profit the deviation specifies how max how much slippage we want to have maximum for his order and we can also specify the magic number which is a unique number that is assigned to every strategy or algo strategy in military 5. you can also add comments in this case we have python script open and also specify the time and filling of the order here we are using gtc which stands for go to cancel and we are using ioc which is immediate or cancel immune cancel is an order type that basically says you can partially fill me for the order and you can't fill me for a rest then cancel the order so this dictionary here is wrapped inside mt5 dot order sent and order sent is sending the order to military 5 server to process it in the markets and here we have a print statement to see what this order does if it's successful or if it failed so let's go back to macquarie 5 and let's drag open trade on the chart and this is basically running the script as you can see after dragging this script onto the chart an order has been placed or a position has been opened on your asd by volume one we see now that this python script works and we can also confirm that in the experts tab where we have the order result of this order this is it for this video thank you very much for watching please like and subscribe and i will be back with another video
Info
Channel: TraderPy - Algorithmic Trading
Views: 509
Rating: undefined out of 5
Keywords: python, trading, metatrader, coding, mt5, algo
Id: Sc7nIqzWv5g
Channel Id: undefined
Length: 6min 24sec (384 seconds)
Published: Wed Oct 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.