Lo and welcome to my tutorial on machine
learning and programming for the use of
Forex or stock trading and analysis with
the programming we're going to be using
the Python programming language
specifically Python 2.7 we're gonna be
using Python mainly for its user
friendliness plus it's my programming
language of choice but it also makes a
good teaching programming language the
purpose of the series is to teach you
some of the principles to machine
learning back testing statistical
analysis and some programming not to
influence your trading decisions this is
my verbal legal statement this video
series is for educational purposes only
and is not an offer or suggestion to
deal with any financial markets how you
use this information is completely your
responsibility and I'm not to be held
liable okay sounds good
our goal here is to use very basic
machine learning principles to locate
actionable trading rules within stocks
or Forex now I say basic for two reasons
one I'm gonna do my best to keep things
purposely pretty basic
both mathematicians and stock traders
alike tend to use big words to purposely
make things sound more special than they
really are or maybe make themselves feel
better uh-huh you're not gonna really
find any tie here or at least I'm gonna
do my best to keep it simple too we're
going to be doing most of these things
by hand the idea here is to help you all
grow in all of those fields mentioned
above there's plenty of pre-made
packages for things like support vector
machines and neural networks the problem
here in my opinion is this doesn't
actually teach you anything and it
leaves no room for innovation now using
basic machine learning principles to
find the algorithm that's going to be
our first step and that's usually the
step most people finish on whether or
not they use machine learning
the next question is not only to
backtest the algorithm you've found
since that's what actually what's
actually gonna end up happening is we're
gonna wind up with a quote unquote
live trading algorithm which basically
means it's going to change over time it
will be a dynamic algorithm but we're
also going to do the next in my opinion
very important step
that's the backtest that method that was
used to find that algorithm so what I
mean by this is the following it's with
statistical certainty that if you look
at a data set that you can find the best
fit line right that's nothing special
yet we see this all the time or someone
said hey look what I found you know
here's this back tested strategy and it
makes X amount of money that's no good
right
the true test is the forward test the
test on unseen and unaccounted for data
therefore if you've created a sort of
quote-unquote algorithm to define or
derive the best trading strategy then
that algorithm used to find that
strategy right the method to find that
strategy must also have worked in the
past against its quote unquote
theoretical or actual literal future
results right so you should also test
that strategy against data yuvan you've
in theory not seen so you can't actually
back test that method itself and this is
basically to decide whether or not it
would have worked to use that method in
the past to find an algorithm that you
would have also done some back testing
on anyway if you're just looking at the
data set you found the best algo for for
that you know including the back testing
that's really cheating and the
likelihood of that algorithm continuing
app out in the future is statistically
unfavorable so now that we've swallowed
that pill let's go ahead and get all the
tools and things that we'll need to do
this so first we are on syntax comm
which is my website and all we're here
for mostly is a file I do suggest you
guys take a peek around but that's not
what we're here for I'm not trying to
sell you all anything what we're going
to look for is the zip file I've got two
files located within that zip file and
to find that you're gonna go to syntax
comm slash gbp/usd dot zip hit enter and
that should download a zip file and that
zip file is going to contain two files
within it and these are the two files
that you'll find the first files gbp/usd
Forex ratio for one day and the other
files the GB
USD ratio for one month obviously your
any need to extract this but once you've
extracted it you can open up either of
these so we'll open this one and you'll
find yourself looking at one day is
worth a forex data and now I didn't
cheat you guys or give you guys nothing
to work with this is actually as you can
see you sixty-two thousand bits of data
it's bid-ask tick data for this Forex
ratio so it's pretty good data to train
on to start with the next file is a one
month of the month of May I think is
what I cut out yeah so you've got a now
you've got a month's worth which is
actually just over one point one point
six million lines here so a lot of lines
to work with and a lot of data to work
with so it should be pretty fun to use
them and the reason why I split them up
is every time we're trying to work with
at least develop this program using only
you know hundred thousand lines versus
one million lines is gonna make a
sizable difference so that's why we're
gonna do it that way
now back to all the other things that we
need we're going to need a few more
things just besides this Forex data of
course and I also want to stress that
even though we are using Forex data you
can do these principles that we're going
to go through can be used obviously for
stocks as well so don't feel like if
you're looking to do this with stocks
that this isn't going to work out for
you
now the next most important thing are
quite possibly more important than even
the tick data is that we go ahead and
get python and we're gonna be looking
for the python 2 7 so to get python go
to python org then go to download and
what you're gonna want to download is
not three three you want to 75 and
depending on what operating system you
have is gonna be what you download if
you do have a 64-bit operating system I
highly suggest that you download the
64-bit version of Python next we have
Matt plot Lib it is also well first you
get there with matplotlib org then you
will go well it used to be up here but I
guess they've moved it on me right here
downloads and then here you
get the downloader and again you're
gonna want to match the download of what
version of Python you downloaded or your
windows again I recommend 64-bit if you
have a 64-bit system on if you did
download a 64-bit Python you must
subsequently you're also going to need
numpy now if you followed my rules and
you've got a 64-bit version of python
maybe you're wondering why you get a
64-bit version of python I've said this
quite a few and/or quite a few times in
most of my videos so the reason you get
64-bit verses 32-bit is because 64-bit
has no memory well it has one but it's
huge 32-bit programs and applications
are limited to two gigabytes of RAM
usage maximum so naturally if you have a
relatively large file sizes
you're gonna max out that two gigabytes
of RAM pretty easily so that's why I
recommend 64 but you'll be able to get
through this entire tutorial series and
you'll even be able to do some pretty
cool stuff even with that two gigabyte
limit so don't run away if that's you so
if you did do that the next thing we
need is numpy so what Python allows us
to do is program matplotlib is a package
that works with Python that allows us to
do graphing and numpy is a helpful
little tool for doing mathematical
calculations so to get numpy if you
followed everything up to this point and
you do have 64-bit you're going to need
to go to this link here I'll put all
these links in the description
especially this one so it's harder to
find or at least read but what we want
here and what this website is is it's a
bunch of 64 that's a bunch of installers
and it just includes 64-bit versions of
a lot of packages that don't naturally
or natively offer 64-bit installers so a
good example of this is numpy which find
here I use a control F and type out
numpy it's about halfway down the page
and again there is the installers here
if you do have only windows like a
32-bit you can also use the install link
here or you can go to like
sourceforge.net i believe and you can
get the other numpy
source code or the Installer depending
on what kind of computer you're on so
obviously you know if you've got like a
Mac or something or if you're on like a
Linux distribution something like that
you can get in whatever but in the end
just make sure you've got Python - seven
matplotlib and numpy and when you're all
done and you've installed all of these
things you should be able to go to your
Start bar and pull up the python command
line it'll probably be black and not
like this but you can customize it so
that's just why mine's white but anyway
you should be able to type these
following things and you should be able
to say import matplotlib you should be
able to say import numpy and you should
be able to say well that's it that's not
the same port python there anyway you
should be able to import matplotlib and
you should be a little an important
numpy if you can't do those two things
like if you go import and you actually
spell a numpy right but this and you get
this something has gone wrong so if
you're having any trouble installing or
you've got some sort of error going on
feel free to post a comment below and
I'll try to help you guys out so that's
going to conclude the introduction to
what we're going to be getting into and
hopefully you guys are excited and as
always thanks for watching thanks for
your support your subscriptions and it's
all next time