hi everyone welcome back to these good rebirth a tutorial
videos I just wanted to show you a really quick thing that you can do
on me. broke out using a tiny bit have any broker formula language
and that is a two sets ourselves index filter
now this is again one of the best things about every broker is with the tiny
little bit of code
you can actually do the most amazing things a down and you can actually
using index filter you can save yourself a lot of drama
sometimes in your in your trading systems
for example a yet you might use an index fell to
to solve switch of your trading system during really big
you know bear markets if it goes down below
like a certain moving average for example like let's give ourselves
just a really quick examples overlay a moving average
you're like it 200-day moving average and as you can see
using this summer if if if our index for example
in this case the All Ordinaries you might be using the S&P 500 in america
you might be using the Footsie in Europe whatever it is you choose to use
on if it's down below this this moving average then we could tell at our
our I'm trading system to switch off and not take any trades and this can
potentially save us a lot of heartache
during these big bear markets all these big draw down periods
sorry how to weed through this well it's
actually a little bit more simpler than you might think
are all we do is we as we start with any every broke a formula language would go
to analysis
and we go to El formulated up and this will bring up a blank sheet of paper
so this is where we begin our code and oh and what was just walk you through it
because um
what we need to do first is we need to set up and array
or we need to set up an object for our foreign entity which is our index so
to do that what we do I think it's
foreign for for
and if I spell it correctly there we go okay so it turns blue so that means that
every broker recognize that
and that's really good so so far so good because what we're doing is a foreign
entity it's not the closing price
of the arm of vertical that we're using or of the
love the stock that we're using it's a foreign entity that we want to bring
in two-out trading system so then
it asks us for the the ticker love the fart entity that we want to use
in this case the All Ordinaries and then use the order is down under again you
could use the ticket for the S&P 500
all the Footsie or whatever it is you choose Xara is the one that I'm going to
use
the field is the closing price
so let's use closing price and again see how it puts them in inverted commas
that means that we have to put them in inverted commas as well so we do that
and then fix-up Eagles true I don't know what that means but it recommends that
it's true so I'm going to do that
I and then a we put a semicolon at the end
and that closes that little segment of code now on
no we we have got that but we actually need
to solve turn it into an array or objects that we can reference to
at any time so what we could call it
anything we call it some hello index
Eagles foreign
and then that will be a All Ordinaries Index um but let's just
you know you could call anything you like but we'll just call it index just
to keep it nice and simple
so our index will equal the All Ordinaries closing price
mark-up sure now what we want to do
safe we want a filter let's do a filter based on a moving average
so the moving average of the index a and we can call that again we can call
anything we like we call it up Billy Bob's
forbes index
moving average Eagles and then echoed
but I'll you know really so you can call anything a
I don't think we'll go that far we can just call it index moving average
home just but had to keep it up simple again
and how we do moving average we do and I
open the bracket the the index though the
array so the array we want to use is the one that we've already set up
and that's index so we talkin index here so that references
out All Ordinaries that we set it up to reference
then we comma and in the range let's make it
a 150 day moving average of the index
close the bracket and close the arm and close the semi-colon there
so now we have to index ought to arrays
that weekend reference to at a time sorry let's just do some really quick
buy and sell signals
buy and sell and as you can see if it goes bold look it's gone bald there and
it's
a that means that every breath recognizes that so that's happy days
so by he calls let's say a close
greater than or equal to a moving average
I love the closing price of our stock
and a 200-day moving average
and then we want to ad as well and
so as you can see it turns bold and that means that any broker has recognized
that so
again we're on the right track he %uh that's really good and
we want to make its a cool
a what should we do the index I think it was on it so
the index is out array up here so what index
and that's what it means we want index to be
greater than or he called sOooo
amor our index moving average yeah let's try that
index moving average and then close the semicolons
at the end of it so what that means is that's a index closing price
above or equal to our index moving average
over 150 days moving average basically so pretty simple
arm and especially simple cuz we set up those arrays beforehand these to appear
so we can do a cell cell might be
closing price less than 0 equal to a moving average
alva a the closing price of the stock
and 200-day moving average close the bracket
and put a semicolon at the end and hopefully that will give us
if we we can easily check this so really
there we go we just go to our out pretty colored
window hiya and go check okay and
this winter comes up it doesn't come up with any errors and that's exactly what
we want
so we close that of and a
then we can save this is anything we want let's save it as
the index
filter moving average
the greatest how about that the greatest index fell to moving average
just for fun how come put that there close it down cuz I saved it
then we go to analysis up and you know what I go to the autumn
all-american office window I know I'm I know there's a new one
I know there's a new one but I really prefer the old one I
sorry about that everyone how but its I find it so easy to use
and what we call it the greatest something such-and-such
here we go the greatest sin tax bill for moving
perfect okay there it is so it's up there
we edit it just to make sure that it's the same thing that we put in
happy days it is okay so let's try it on
a just a single single symbol and let's go for the sake
Commonwealth Bank of Australia up currently got cost and what's really up
here the moment
and if we just click on current symbol that will do a back test on that simple
for us
now if we look over the last 13 years from 2002-2013
that's how we which is quick from and then putting those values there
so happy days and let's first of all do a test
without the index filter on it so if we
if we edit this and if we just put a semi-colon at the end up here
and then if we to to forward slashes that will comment
out our index filter that we put in there and if we just save that
and if we go back test there we go
as as you can see it took no time at all to do and if we do report
there we go our net risk-adjusted return
is a 128 percent over
over 13 years and there is a equity
curve right there so it let's see how that performs
when we put on the index fell to and if we just
at edit this again take add a Comment add line
and take at a semi-colon so now we've got our
our index greater than or equal to index moving average
will make the moving average a 125 just so that we're not too crazy we don't
want to be too large
um and then if we close that down
click back test again then we
click on report and as you can see
okay so a net risk-adjusted return is now a hundred and ninety-five percent
instead have
128 percent before so that has given us
quite a significantly larger return and as you can see these flat periods hiya
that's when an hour in but that's what our index fell to kicked in
so right here so pretty much during 2002
bear market and during 2000 and
I bear market the system actually switched off
and it would not allow us to take a more trays trades
so it made it flat equity curve there so that could be going down down down down
down
but it's actually saved us during that period um
this period was not so lucky I so as you can see is no perfect
however it has saved us a little bit and obviously it's increased their return
by about 70 percent sixty to seventy percent
over 30 years there which is pretty good guitar that's for one stock you know if
you doing this over 20 different stocks
in a portfolio then you'd get a better return again so on and you can look at
%uh position sizing video for that one as well cuz that will show us a
that showed us how to look at twenty individual
stocks in your portfolio at any one time but yes you can see that's
that's an index filter and that sir just a great way to
to sort of do it have a play around with it and make it your own
you could set it for anything else on the kids you could
turn the index an index um filter to be
anything you wanted really news hot high-value
user
horrifying for relative strength really
some you
anyway I hope that helps to us have it running until next time
calcium xvideos bye for now
cast