Peak Algo Trading Full Course | Commodity Market Futures — Transcript
Full transcript
- 0:00you want to start algorithmic trading
- 0:03and you understand that there are
- 0:04massive advantages in being able to test
- 0:07different trading approaches using
- 0:09historical data with the goal of being
- 0:11able to eventually automate those
- 0:13trading systems to execute trades and
- 0:16generate profits in real time and
- 0:18whether you're an analyst at a commodity
- 0:20trading house and you want to use
- 0:22algorithms for market analysis or you're
- 0:25a Trader at a hedge fund and you want to
- 0:27build a portfolio of algorithms to
- 0:30complement your current trading approach
- 0:32or you're a private Trader looking to
- 0:34diversify your Investments with
- 0:36commodity Futures you can future proof
- 0:39your career you can add an important
- 0:41skill set to your resume and Linkedin
- 0:44you can become a better more profitable
- 0:46more confident Trader there has never
- 0:49been a better time to start I'll go
- 0:52trading I'm Dave Whitcomb head of
- 0:54research for Peak trading research and
- 0:56this algo trading course built by the
- 0:59commodity special specialist at Peak is
- 1:01your number one tool for getting started
- 1:04with algorithmic trading in commodity
- 1:07markets algorithmic trading also called
- 1:10systematic trading or Quant trading or
- 1:13as we prefer to call it at Peak
- 1:15rule-based trading or evidence-based
- 1:18trading it's how the world's most
- 1:20successful hedge funds and Traders make
- 1:22profits there is a reason that ninety
- 1:26percent of Traders don't make money it's
- 1:28because technicals don't work most
- 1:30Candlestick patterns don't work and
- 1:33journaling about your emotions about the
- 1:35market doesn't work the good news is
- 1:37that you can quickly join the top 10
- 1:40percent of Traders and have a much
- 1:42better chance of generating real profits
- 1:45in real time if you master the
- 1:48algorithmic trading Basics that we will
- 1:50cover in this course you can think of
- 1:52this course as a full University course
- 1:56on algorithmic trading for commodity
- 1:58market futures but that said all of the
- 2:02concepts that we'll be learning are
- 2:03applicable to any Market that includes
- 2:06stocks bonds FX cryptos the algorithmic
- 2:10trading Concepts that we'll be talking
- 2:12about are Universal this 2023 course
- 2:15comprises 16 different sessions which
- 2:18Focus broadly on algorithmic trading
- 2:21Basics system building blocks
- 2:23optimization incubation and portfolio
- 2:26construction and finally getting started
- 2:28with live trading now what you are
- 2:31watching right now is the full course
- 2:33I'm not going to ask you to join some
- 2:36slack Channel or Discord or patreon this
- 2:39is it this is the full course and you
- 2:42don't even need to take notes all of the
- 2:45code that we're going to walk through
- 2:47all of the cheat sheets and some great
- 2:49bonus extras are available in the full
- 2:52course packet that you can find at Peak
- 2:55algo.com the only thing that I will ask
- 2:58is that if you have any questions along
- 3:01the way please pop them in the comments
- 3:04below this really helps our Channel grow
- 3:06and helps us improve future iterations
- 3:09of this course so with that algorithmic
- 3:12trading full course 2023 let's get into
- 3:16it
- 3:18foreign
- 3:19[Music]
- 3:23if you are watching this course you
- 3:25likely already know that there are some
- 3:28massive advantages to algorithmic
- 3:30trading in this section we're going to
- 3:32talk about these six main advantages to
- 3:35algo trading and why you should stop
- 3:37wasting your time and your energy and
- 3:40your money on discretionary trading so
- 3:43let's jump into it let's start with the
- 3:45number one advantage to algorithmic
- 3:47trading and that is back testing when
- 3:50you trade quantitatively when you trade
- 3:52using algorithms you are pre-defining a
- 3:56set of rules that you are going to use
- 3:58to trade and when you write down your
- 4:00strategy logic when you actually code
- 4:03that trading system you can then back
- 4:05test that system using historical data
- 4:08so whether the trading idea that's in
- 4:11your head is a breakout approach or a
- 4:13mean reversion approach or a seasonal
- 4:16trading approach you can test that
- 4:18trading approach you can test the
- 4:21trading system and if you're using a
- 4:22professional trade trading platform like
- 4:24tradestation or multi-charts you can add
- 4:27that strategy to a chart to see visually
- 4:30how the system will trade and you can
- 4:32also look at historical performance
- 4:34statistics my favorite of which is an
- 4:37equity curve so what is an equity curve
- 4:40an equity curve shows you your
- 4:42cumulative profits that you would have
- 4:44generated had you traded this system
- 4:47through time for example this Equity
- 4:50curve on Coco 128 minute price bars
- 4:54shows me that this trading system would
- 4:57have made about 85
- 5:00000 in cumulative profits since early
- 5:032010. if you are a visual learner which
- 5:06most Traders tend to be you'll find that
- 5:09an equity curve is a really quick way to
- 5:12see if a strategy Works a nice upward
- 5:15sloping Equity curve shows you that the
- 5:17strategy at least historically has made
- 5:20money over time without a lot of big
- 5:22draw pounds without a lot of periods
- 5:25where the strategy did not work so for
- 5:27example if you are looking to evaluate a
- 5:30strategy that you're getting from an
- 5:32external Source like Peak algo.com the
- 5:35first thing you're going to want to see
- 5:37for that strategy is likely an equity
- 5:39curve and you'll also want to know if
- 5:42that Equity curve assumes realistic
- 5:44slippage and commission costs but bottom
- 5:47line that first advantage of algorithmic
- 5:50trading is back testing it allows you to
- 5:52look at performance statistics to see if
- 5:55the strategy works and it allows you to
- 5:57see that Equity curve the number two
- 5:59advantage to algorithmic trading is that
- 6:02you are always in the market your
- 6:04systems can always be on you can turn on
- 6:07your trading systems so that they are
- 6:09always in the market they are always
- 6:11looking to take new trades or exit
- 6:13trades to manage risk and they're doing
- 6:15this with a better attention span and a
- 6:18better reaction time than a human ever
- 6:20could and this is related to Advantage
- 6:23number three and that is your trading
- 6:25will become more consistent it doesn't
- 6:27matter if you haven't slept well or
- 6:29you're having a bad day or you're
- 6:31distracted by other things your trading
- 6:34systems are always on they will always
- 6:36react consistently this means you can be
- 6:39far more consistent with how you deploy
- 6:42your trading capital and how you manage
- 6:44your risk reason number four is better
- 6:47diversification if you are discretionary
- 6:50trading you are likely glued to your
- 6:52screen all the time watching just a
- 6:55handful of markets if you are
- 6:56algorithmic trading the number of
- 6:58trading systems that you can run really
- 7:00just depends on your account size your
- 7:03capital and how many good trading
- 7:06systems you have every Trader is
- 7:08different but for me I find that that
- 7:10sweet spot is generally around 25 to 30
- 7:13trading systems fewer than that and I
- 7:16tend to find I don't have a lot of
- 7:18active trades at any given time but more
- 7:21than that and I tend to kind of lose the
- 7:23plot lot but every Trader is different
- 7:25maybe you just want to flip on five
- 7:28automated trading systems for the energy
- 7:30markets and your friend wants to flip on
- 7:3250 different trading systems across all
- 7:35the different liquid US futures markets
- 7:37reason number five is better risk
- 7:40management one of the biggest problems
- 7:42that discretionary Traders often have is
- 7:45taking stops and taking profit you could
- 7:48add a stop loss or take profit level or
- 7:50a trailing stop to every single one of
- 7:53your systematic trading strategies not
- 7:55only is this good in risk management but
- 7:57it just helps you sleep better at night
- 8:00it's a huge Advantage versus
- 8:02discretionary trading knowing that you
- 8:04can take that human emotion out of
- 8:06things reason number six and I cannot
- 8:09overstate how important this one is is
- 8:12confidence the number one advantage that
- 8:15you will notice when you get into
- 8:17algorithmic trading is that your
- 8:19confidence in your trading approach and
- 8:22your trading systems will increase you
- 8:25can write down your trading approach you
- 8:27can code it up you can back test it you
- 8:30can look at a performance report and
- 8:31hopefully see a nice upward sloping
- 8:34Equity curve for your strategy which
- 8:36gives you the confidence that this
- 8:38trading approach would have worked for
- 8:39the past 10 or 15 or 20 years there is
- 8:43nothing that comes close to that in the
- 8:46world of discretionary trading you can
- 8:48also perform some more advanced
- 8:50analytics on your historical strategy
- 8:52returns like Monte Carlo analysis walk
- 8:55forwards correlation tables you can also
- 8:58incubate your strategies you can see how
- 9:01your systematic strategies perform by
- 9:03paper trading on new unseen data to give
- 9:06you the confidence that this strategy
- 9:09will probably hold up in real time but
- 9:11again the confidence that you can get
- 9:13from coding a strategy testing it seeing
- 9:16how it would perform in real time this
- 9:19is a huge Advantage those are the six
- 9:21big advantages of algorithmic trading
- 9:24now let's move on and talk about what
- 9:27you need to get started with algorithmic
- 9:30Trading
- 9:33[Music]
- 9:37in our last session we talked about the
- 9:40big advantages of algorithmic trading
- 9:42now let's talk about the things that you
- 9:44need to get started with algorithmic
- 9:46trading there are four main things that
- 9:49you need to get started algorithmic
- 9:51trading number one you need a trading
- 9:53platform number two you need data that
- 9:57that platform can access for system
- 9:59analysis or real-time trading number
- 10:03three you need a funded brokerage
- 10:05account and finally number four you need
- 10:08a trading system or preferably a
- 10:11portfolio of trading systems in terms of
- 10:14finding a good trading platform you have
- 10:16a lot of choice between different
- 10:18desktop or web-based or mobile trading
- 10:21applications in which you can write
- 10:23strategy code you can back test that
- 10:26strategy code on historical data and you
- 10:29can eventually automate the strategy to
- 10:31execute Market orders on your behalf
- 10:34these are some of the most popular
- 10:36trading platform forms and the strategy
- 10:39coding language that each platform uses
- 10:42tradestation and multi-charts both use
- 10:45Easy language metatrader uses mql four
- 10:48or five trading view uses its own
- 10:51proprietary Pine script ninjatrader uses
- 10:55ninjascript which is based on c-sharp
- 10:57and quantopian uses python now in this
- 11:00course we're going to be focusing mostly
- 11:02on easy language which is the coding
- 11:04language used by both tradestation and
- 11:07multi-charts tradestation and
- 11:09multi-charts are exceptional trading
- 11:12platforms for systematic trading in
- 11:15commodity Futures if you want to see a
- 11:17deep dive on the differences between
- 11:19tradestation and multi-charts you can
- 11:22click a video link here easy language as
- 11:25the name suggests is an exceptionally
- 11:27easy to learn coding language that's
- 11:29written specifically for Traders it's
- 11:32easy to write it's easy to understand a
- 11:34lot of popular trading books the kind
- 11:36we'll talk talk about at the end of this
- 11:38course are written in Easy language now
- 11:41we're going to be going through a lot of
- 11:42easy language strategies in this course
- 11:45but remember if you're using another
- 11:47platform like metatrader or trading view
- 11:50or ninjatrader you can always take that
- 11:53strategy code and translate it to your
- 11:56platform all of the concepts that we're
- 11:58going to be talking about in today's
- 11:59course are Universal they are not
- 12:02specific to any one coding language data
- 12:06the second thing that you are going to
- 12:08need to start systematic trading is data
- 12:11your trading platform is going to need
- 12:13to have access to historical data for
- 12:17analysis and testing of your systematic
- 12:20trading systems and ultimately your
- 12:22trading platform is going to need access
- 12:24to live data so you can execute
- 12:27systematic trading strategy orders in
- 12:30real time now every trading platform is
- 12:33different some trading platforms like
- 12:36tradestation are your data provider but
- 12:39other trading platforms like multi
- 12:41charts will require that you plug into
- 12:44an external data provider every trading
- 12:47platform is different on how they treat
- 12:49data and how you can subscribe to data
- 12:52but that information is always very
- 12:54clear on their website how you can plug
- 12:57in data to the trading platform and you
- 13:00should be prepared that this will be an
- 13:03additional expense for example if you're
- 13:05a commodity Trader you might want to pay
- 13:07for Chicago Board of Trade data for
- 13:10markets like corn and wheat and soybeans
- 13:13you'd start with delayed data for your
- 13:15strategy analysis and testing that will
- 13:18be cheaper something like twenty dollars
- 13:20a month and then when you're ready to
- 13:22start systematic trading in real time
- 13:24you can start paying for live data
- 13:27that's going to be more expensive say a
- 13:29hundred dollars a month very big picture
- 13:31whether you're using delayed data or
- 13:34live data these trading platforms make
- 13:36it very easy for you to get data into
- 13:39their platforms for your analysis or
- 13:42live trading the third thing that you
- 13:44need to get started algorithmic trading
- 13:47is a funded brokerage account when you
- 13:50trade commodity Futures The Exchange
- 13:52that you are facing needs access to what
- 13:55is called margin basically you need to
- 13:57set a small amount of money aside like a
- 14:01down payment for the right to trade
- 14:03commodity Futures contracts here is a
- 14:06great cheat sheet that we've put
- 14:07together with the margin rates for the
- 14:10top 25 U.S commodity Futures markets
- 14:13this is included in the full course
- 14:16packet that's available at Peak algo.com
- 14:19what you'll see is that for a market
- 14:21like corn you need to have at minimum
- 14:24twenty three hundred dollars in your
- 14:26account in margin to trade one contract
- 14:29of corn Futures now that's the minimum
- 14:32amount that you need in your account
- 14:34realistically you are going to want more
- 14:37than that how much money do you need to
- 14:40trade a systematic trading strategy as a
- 14:44good rule of thumb you are generally
- 14:46going to want to have 2.5 times the
- 14:50minimum required margin for that
- 14:52contract what does that mean you take
- 14:55the number in that margin column and you
- 14:58multiply it by 2.5 now for a market like
- 15:01heating oil with a big contract value
- 15:04and a relatively high margin of about
- 15:07ten thousand dollars that means that
- 15:09your trading account should have twenty
- 15:12five thousand dollars in it for every
- 15:15heating oil systematic trading strategy
- 15:17that you turn on now I know this is
- 15:20frustrating especially for beginners I
- 15:22know this is probably not what you want
- 15:25to hear that you need to have a whole
- 15:26lot of money set aside for margin the
- 15:28good news is there are plenty of
- 15:30commodity markets with relatively small
- 15:33notional sizes and small margin
- 15:36requirements the there are also micro
- 15:39and mini contracts so a lot of these
- 15:41contracts have smaller versions that
- 15:44require about a fifth of the size of
- 15:47margins set aside you're just getting
- 15:49started in systematic trading or you
- 15:51have a smaller brokerage account size it
- 15:53is a great option to start with mini and
- 15:57micro size contracts in terms of a
- 15:59funded brokerage account there are some
- 16:02big differences between the different
- 16:04trading platforms for example
- 16:06tradestation acts as your broker so you
- 16:09directly fund an account you send money
- 16:12to tradestation or as multi charts can
- 16:14plug into a number of different Brokers
- 16:17you just give them access to your
- 16:20trading account but again big picture
- 16:22any trading platform is going to need
- 16:25access to money to investment to Capital
- 16:28that you've set aside to trade the
- 16:31fourth and final thing that you need to
- 16:33start systematic trading is a trading
- 16:37system or even better a set of different
- 16:40Diversified trading systems across a lot
- 16:43of different markets we're going to come
- 16:45back to this theme time and time again
- 16:47in this course that one of your big
- 16:50advantages as a systematic Trader is
- 16:52your ability to turn on lots of
- 16:55different Diversified Futures Trading
- 16:58strategies now as part of this course we
- 17:00are going to go through the building
- 17:03blocks for successful systematic trading
- 17:06strategies entries exits filters and of
- 17:09course if you want instant access to a
- 17:12portfolio of Diversified Futures Trading
- 17:15strategies you can head to peakalgo.com
- 17:18these are real systematic trading
- 17:21strategies that have performed well in
- 17:23real time that are in tune with the
- 17:25current market they had positive profits
- 17:28in the month prior so whether you're a
- 17:30beginner looking for coding examples of
- 17:33real systematic trading strategies or
- 17:36you're a professional commodity Trader
- 17:38looking to build out your portfolio
- 17:40these strategies at Peak algo.com are a
- 17:43great option so those are the four
- 17:46things that you need to start systematic
- 17:48trading trading platform data that you
- 17:51can plug into the platform for analysis
- 17:54and real-time trading a brokerage
- 17:57account that your trading platform can
- 17:59access to trade and you need a trading
- 18:02system preferably trading systems and
- 18:05that is now what we're going to spend
- 18:07most of this course talking about is how
- 18:10you can build and test fully coded
- 18:13systematic trading strategies that have
- 18:15a great chance of working in real time
- 18:21thank you
- 18:25now before we move on I want to say a
- 18:28few quick notes about Peak trading
- 18:30research and what puts us in such a
- 18:32unique position to build an algo trading
- 18:35course like this P trading research is
- 18:38an independent quantitative commodity
- 18:41research company based in Switzerland we
- 18:44focus on non-fundamental quantitative
- 18:47price drivers for agriculture energy and
- 18:50metals commodity markets our clients are
- 18:53hedge funds family offices private
- 18:56Traders and many of the world's largest
- 18:58commercial trading houses and because we
- 19:01provide a unique and quantitative view
- 19:04on commodity markets we are frequently
- 19:06quoted in the Wall Street Journal the
- 19:08financial times market watch warning
- 19:11star Bloomberg and other Publications
- 19:14and as part of our research for our
- 19:16clients we are building and testing a
- 19:19lot of quantitative trading systems many
- 19:22of those systems we make available to
- 19:25clients through our site Peak algo.com
- 19:28so this course is both for our commodity
- 19:31research clients who are interested in
- 19:33getting up to speed with building and
- 19:35testing systematic trading strategies as
- 19:38well as our algo trading clients who are
- 19:41interested in building a portfolio of
- 19:43systematic trading strategies so if you
- 19:46are looking for an algorithmic trading
- 19:49course built by an industry-leading
- 19:51quantitative commodity research company
- 19:54hosted by a professional commodity
- 19:56Trader with more than two decades of
- 19:59experience at two of the US's largest
- 20:02private commodity trading houses then
- 20:04you have come to the right place now one
- 20:07of the advantages of algorithmic trading
- 20:11of rule-based trading is that you can
- 20:13confirm for yourself all of the concepts
- 20:17that we will cover in this course you
- 20:19should not trust any Trader any educator
- 20:22any research company without confirming
- 20:25the results for yourself and that is a
- 20:28theme that will be coming back to again
- 20:30and again in this course is that you can
- 20:32build strategies yourself test
- 20:34strategies yourself and set your
- 20:37portfolio of real systematic trading
- 20:39strategies up to have the best chance of
- 20:42generating profits for you in real time
- 20:45we've now finished the first section of
- 20:47this course which is algo Basics and
- 20:50we're going to move on to the second
- 20:52section of this course which is system
- 20:54building blocks this is the foundation
- 20:57the very beginning of the systematic
- 21:00strategy development process this is
- 21:03what successful systematic trading
- 21:05strategy development looks like we are
- 21:08going to spend the next five sessions at
- 21:11the bottom of this mountain at the
- 21:13foundation of this strategy development
- 21:16pyramid in this section on system
- 21:19building blocks we'll talk about systems
- 21:22building 101 go through some entries
- 21:24exits some system examples and also
- 21:28entry filters and after that we'll move
- 21:30on to the next section on optimization
- 21:33incubation and portfolio construction
- 21:36now in the next few sessions we'll be
- 21:39looking at a lot of strategy logic that
- 21:41is written in the easy language coding
- 21:44language all of this strategy code the
- 21:47entries the exits the strategy system
- 21:50examples that we'll go through our Opus
- 21:53strategy that you can use to test
- 21:55thousands of different entry and exit
- 21:57combinations and a version of our
- 22:00filters code built specifically for this
- 22:03course is available in the course packet
- 22:06that you can find at peakalgo.com so
- 22:09don't feel that you need to spend your
- 22:11time writing this out typing it out
- 22:13taking screenshots all of the code that
- 22:15we'll go through is available as text
- 22:17files and also if you're a tradestation
- 22:20or multi-charts user as CSV files again
- 22:23that is all available in the course
- 22:26packet at Peak algo.com let's now move
- 22:29on to the next section system building
- 22:32blocks
- 22:35[Music]
- 22:38foreign
- 22:39big picture let's review what we've
- 22:42talked about in this course so far we've
- 22:44talked about algo trading 101 what is
- 22:47algorithmic trading we talked about the
- 22:49massive advantages of algorithmic
- 22:52trading versus discretionary trading and
- 22:54we've reviewed the four things that you
- 22:57need to get started with algorithmic
- 22:59trading so now let's move on to the fun
- 23:01stuff let's talk about building and
- 23:04testing real systematic trading
- 23:06strategies as well as the tools and
- 23:09Concepts that you need to understand to
- 23:12ensure that your systematic trading
- 23:14strategies have a great chance of making
- 23:17money and generating profits in real
- 23:19time now algorithmic trading is
- 23:22rule-based trading you are telling your
- 23:24trading platform that you want to trade
- 23:27a certain Market based on a predefined
- 23:29set of rules and when you write down
- 23:32those rules in a certain coding language
- 23:34you are writing a script you are writing
- 23:38a simple set of rules that your trading
- 23:40platform can access and add to a chart
- 23:43and generate profit statistics so you
- 23:46can gauge if you want to trade that
- 23:48strategy or not and all of the automated
- 23:50trading platforms that we talked about
- 23:52in our section on the four things you
- 23:54need to start algorithmic trading all
- 23:57those trading platforms are chart-based
- 24:00trading platforms meaning you're writing
- 24:02your script you're writing down The
- 24:04rules that you want to trade you're
- 24:06adding that script to a chart and then
- 24:08you're deciding based on how the system
- 24:11trades The Profit statistics if you want
- 24:14to automate that trading system that's
- 24:16the process we're going to be talking
- 24:18about again and again in this course
- 24:20writing a script adding it to a chart
- 24:22looking at how the system trades and
- 24:25some profit statistics and deciding if
- 24:27it's a good trading system now all
- 24:30trading strategies are written as
- 24:32conditional if then statements it
- 24:35doesn't matter if you're coding in the
- 24:37easy language coding language or pine
- 24:40script or python or C sharp every
- 24:43strategy that you write is going to be a
- 24:46complete conditional statement these
- 24:48conditional statements are almost always
- 24:50written as if this condition exists then
- 24:54do this and that this is mostly trade
- 24:57the market some good examples of simple
- 24:59conditional statements are if momentum
- 25:02is positive then I the market so buy a
- 25:06Futures Contract if a moving average is
- 25:09crossing below another moving average
- 25:12then sell the market if it's January
- 25:1515th then buy the market and get out
- 25:19after 20 days these are simple
- 25:21conditional if then trading statements
- 25:24now one of the big advantages of the
- 25:26easy language coding language that we'll
- 25:28be using a lot in this course is that as
- 25:32the name suggests it's a very easy
- 25:34language to understand when you are
- 25:36writing down your trading rules that the
- 25:39system and will follow those conditional
- 25:41if then statements easy language really
- 25:44writes and reads like a sentence so
- 25:47let's look at an example of one of these
- 25:50if then statements let's look at a very
- 25:52simple two-line complete systematic
- 25:56trading strategy let's jump into the
- 25:58trade station trading platform now this
- 26:01is what tradestation looks like right
- 26:04out of the box so if you have never used
- 26:06tradestation or you've never used any
- 26:09other automated trading platform this is
- 26:12generally what a automated trading
- 26:14platform will look like to start we are
- 26:16going to go up and open up our easy
- 26:19language editor think of this as the
- 26:22place where you are going to write your
- 26:24scripts you are going to write down the
- 26:27rules and the strategies that you want
- 26:30to trade I'm going to open up a new
- 26:31strategy I am simply going to call this
- 26:34our first strategy two lines of code
- 26:39simple enough I'm going to delete the
- 26:42starter code that it gives us and for
- 26:44this strategy we are going to write this
- 26:46like a sentence so we're going to build
- 26:48a momentum strategy that says if the
- 26:51close is the highest close of the past
- 26:5410 days then by the next bar at Market
- 26:58so basically get in on the next possible
- 27:01opportunity the next time the Market
- 27:03opens if this is a daily bar and then if
- 27:06time has passed so if 10 bars have
- 27:10passed so if we're using daily bars that
- 27:12will be 10 days if 10 bars have passed
- 27:15since I bought the market then sell next
- 27:18bar at Market this is now a complete and
- 27:23I'm going to verify it so I know it's a
- 27:25complete strategy this is a complete
- 27:27fully coded systematic trading strategy
- 27:30it has those nice conditional statements
- 27:33if the market is going higher so if the
- 27:35market closes the highest close then buy
- 27:38that upward momentum them and if 10 bars
- 27:41have gone by or 10 days have gone by get
- 27:44out of that long position now that we
- 27:46have our strategy written let's add our
- 27:48strategy to a chart so we are going to
- 27:52bring up a chart and let's make this a
- 27:56heating oil chart so we are going to be
- 27:58looking at the heating oil Futures
- 28:01Market I'm going to go to my time frame
- 28:03customize there's the ticker for heating
- 28:05oil at ho is the heating oil continuous
- 28:09contract and let's make this
- 28:11240 minute bars so that is a four hour
- 28:15bar Futures let's go back to 2010 and
- 28:18voila there is the chart for heating oil
- 28:22240 minute bars I can then add the
- 28:25simple strategy script that we've
- 28:27written that two lines of code simple
- 28:30first strategy two line of code strategy
- 28:32and there we go tradestation can see it
- 28:35tradestation says this is a good
- 28:36strategy let's pop it in the chart and
- 28:38we can see how this strategy trades on a
- 28:43chart it's a momentum strategy again we
- 28:45are buying higher closes so if the close
- 28:48is the highest close of the past 10 bars
- 28:51the past 10 240 minute bars the system
- 28:54will buy buying upward momentum getting
- 28:57out after 10 bars buying upward momentum
- 28:59getting out after 10 bars it's generally
- 29:01a pretty good momentum strategy now one
- 29:04of the advantages of this being a
- 29:06rule-based system a systematic trading
- 29:09strategy is that we can look at a
- 29:11strategy performance report we can see
- 29:14that simple approach of buying upward
- 29:17momentum buying higher closes in the
- 29:20heating oil Futures Market it's done
- 29:22okay the strategy has made about a
- 29:24hundred and twenty thousand dollars over
- 29:26the past 12 years if we look at a equity
- 29:30curve it's okay it's done well recently
- 29:32not so well in the Years prior but as a
- 29:35starting point it's good to see that
- 29:38this simple breakout system two lines of
- 29:40code can make money in heating oil
- 29:43Futures so that's systematic trading
- 29:45writing down simple rule-based
- 29:48conditional statements adding that
- 29:50strategy to a chart so we can see how
- 29:52the system trades and we can look at
- 29:54some basic profit statistics this is the
- 29:57core of systematic trading and it's what
- 29:59we're going to be spending a lot of this
- 30:01course doing building strategies testing
- 30:04strategies see how they trade and gauge
- 30:07if it's a strategy that we want to turn
- 30:09on and automate to generate profits in
- 30:12real time now one quick note before we
- 30:14move on we wrote that simple trading
- 30:17strategy in the easy language coding
- 30:19language but here's that same strategy
- 30:22written in hindscript and that same
- 30:25strategy written in ninjascript C sharp
- 30:28what you'll notice is that once you
- 30:30understand what that easy language code
- 30:33is accomplishing buying a higher high
- 30:35getting out after 10 bars differences
- 30:38between easy language Pine script and
- 30:41ninja script and python it's like the
- 30:43differences between Italian and Spanish
- 30:46and Portuguese and French these are the
- 30:48romance languages of systematic trading
- 30:51so again in this course today focus more
- 30:54on the trade logic and what we're doing
- 30:57with these strategies don't get too hung
- 30:59up on the fact it's written in Easy
- 31:01language all of the concepts that we're
- 31:03talking about today are Universal to
- 31:06systematic trading regardless of the
- 31:09coding language that you use now we're
- 31:11going to be doing a lot of strategy
- 31:13building today but if you want to watch
- 31:16another video on building a simple
- 31:19systematic trading strategy you can
- 31:21click here to watch our video titled
- 31:24build your first strategy it's another
- 31:26good overview of some of the simple
- 31:28building blocks that we'll be going
- 31:30through today entries exits variables
- 31:33filters and that's what we'll be talking
- 31:35about in our next three sessions is
- 31:38strategy entries strategy exits filters
- 31:41really those fundamental building blocks
- 31:43that you can use to create exceptional
- 31:46systematic trading strategies so let's
- 31:48move on to the next session and talk
- 31:50about the most fundamental building
- 31:52block of a systematic trading strategy
- 31:55great strategy entries
- 31:59foreign
- 32:00[Music]
- 32:05strategy has two important building
- 32:07blocks and that is entries and exits a
- 32:10strategy entry gets you into a long or
- 32:13short position in a commodity future or
- 32:16stock or Bond and an exit gets you out
- 32:19of that position so let's look at the 10
- 32:21greatest of all time entries that you
- 32:24can be using to build profitable
- 32:26systematic trading strategies and of
- 32:28course you don't need to write any of
- 32:30these entries down they're all available
- 32:32in the peak I'll go trading package at
- 32:35peakalgo.com now what makes these the
- 32:38greatest trading entries you are going
- 32:40to see these trading entries time and
- 32:42time again in the strategies that we
- 32:45build at peakalgo.com you'll see them in
- 32:47systematic strategy books you'll see
- 32:49them in YouTube videos online and most
- 32:52importantly you'll find yourself falling
- 32:54back on these strategy entries as a
- 32:56great Foundation upon which you can
- 32:58build more complicated systematic
- 33:01strategies bottom line they work you're
- 33:04going to see them a lot and most of the
- 33:06strategies you build and trade will rely
- 33:09on these basic strategy entries now as
- 33:11always we'll be going through these
- 33:13strategies written in the easy language
- 33:15coding language but focus more on the
- 33:18strategy logic what the strategy is
- 33:20trying to do and less on the specific
- 33:23code so if you want to recreate what
- 33:25these strategies are doing in python or
- 33:28r or C plus plus or Microsoft Excel you
- 33:32can do that these strategy concept
- 33:34entries are Universal for our first
- 33:37strategy entry let's look at a simple
- 33:40price pattern what this strategy does is
- 33:43it says if the close of the last bar was
- 33:46greater than the open of the last bar
- 33:48and the close two bars ago was greater
- 33:51than the open two bars ago and the close
- 33:53three bars ago was greater than the open
- 33:56than buy next bar at Market so buy
- 33:58upward momentum and vice versa if you
- 34:01have lower closes for three bar bars in
- 34:05a row then sell short the next bar at
- 34:08market now one of the advantages of
- 34:10course of coding this up and adding it
- 34:13to a platform like tradestation is that
- 34:15we can see how this strategy works on a
- 34:18chart so here we have three lower bars
- 34:21the strategy sells short we have three
- 34:23Rising bars the strategy goes long this
- 34:27strategy on crude oil 240 minute bars
- 34:30has been working pretty well recently
- 34:33the strategy successfully bought upward
- 34:35momentum sold upward momentum bought
- 34:37upward momentum and sold downward
- 34:40momentum now for our next strategy entry
- 34:43let's look at a simple breakout this
- 34:45works well for markets that Trend so
- 34:48what this strategy does is it says if
- 34:51the market close of the last bar is the
- 34:54highest close of the past 10 bars then
- 34:57buy the next bar at market and if the
- 35:00market closed is the lowest close of the
- 35:03past 10 bars then and sell short at
- 35:06markets so again it's a different way to
- 35:08buy upward momentum and sell downward
- 35:10momentum and we can see what this
- 35:13strategy looks like on a chart let's add
- 35:16this to a gold 240 minute bar chart you
- 35:20can see that when we're at the highest
- 35:23close of the past 10 bars the system
- 35:26goes long when we're at the lowest close
- 35:28of the past 10 bars the system sells
- 35:31short gold Futures system chopped around
- 35:33a little bit here bought and sold and
- 35:36bought and then here it went short again
- 35:38at the lowest bar of the last 10 bars
- 35:40and successfully made a nice short trade
- 35:43now this is a good opportunity for us to
- 35:47add our very first input so we can add
- 35:51an input called length x and replace our
- 35:55static value of 10 bars with our new
- 35:58input and this allows us to optimize
- 36:01this input value in trade state trade
- 36:05station will tell us instead of 10 the
- 36:07best value to use between 5 and 15 is
- 36:11going to be a value of 5. so if we
- 36:14optimize for net profit we can see that
- 36:17actually a value of 5 is better than 10
- 36:20for buying higher highs and selling
- 36:23lower lows we can see the system is
- 36:25doing pretty well here in terms of
- 36:28buying higher highs selling lower lows
- 36:30it's catching some nice moves on gold
- 36:33240 minute bars now let's look at a
- 36:36simple mean reversion entry this is for
- 36:39markets that mean revert so unlike our
- 36:43breakout strategy that buys higher
- 36:46closes in this case we are going to be
- 36:48selling short the highest close of the
- 36:51last X bars so this was our breakout
- 36:54strategy instead of buying a higher
- 36:57close we are going to sell short and
- 36:59instead of selling short on a lower
- 37:02close we're going to be buying so again
- 37:05selling short a higher close buying a
- 37:08lower close and if we add our strategy
- 37:11our mean reversion strategy entry to a
- 37:14mean reverting market like the Coco
- 37:17Market this is Coco daily bars we can
- 37:19see that this simple mean reversion
- 37:21strategy that buys lower closes sells
- 37:24higher closes buys lower closes sells
- 37:27higher closes has been working
- 37:29exceptionally well in a mean reverting
- 37:32sideways trading Market environment for
- 37:35our next strategy entry let's look at
- 37:37using a market indicator like trading
- 37:40volume or RSI momentum or macd momentum
- 37:44or adx momentum as a requirement before
- 37:49buying lower closes or selling short
- 37:51higher closes basically this trading
- 37:54system is looking for a low volume or a
- 37:58low momentum reversal as a signal to
- 38:01trade we can see what this looks like in
- 38:04feeder cattle which is a smaller Market
- 38:07in which volume is an important
- 38:09indicator for the next direction of the
- 38:12market this system does a nice job of
- 38:15selling short higher closes buying lower
- 38:18closes when volume is also dropping at
- 38:21the same time we can see that the system
- 38:23has performed fairly well over the past
- 38:26year we see a nice upward sloping
- 38:29cumulative profit line an upward sloping
- 38:32Equity curve for our next strategy entry
- 38:35let's look at dueling momentum and this
- 38:38will be the first time that we
- 38:40incorporate a second strategy input
- 38:43called length two so in this case we are
- 38:46going to be going with short-term
- 38:48momentum in this case 15 bar momentum
- 38:51against long-term momentum for example
- 38:5450 bar momentum so how does this
- 38:57strategy work if the most recent close
- 38:59is above the close 15 bars ago but still
- 39:04below the close 50 bars ago the strategy
- 39:08will buy the next bar at market and vice
- 39:11versa of the most recent close is below
- 39:14the close 15 bars ago but above the
- 39:17close 50 bars ago the strategy will sell
- 39:20short next bar at Market if we add our
- 39:23dueling momentum strategy to an orange
- 39:26juice 230 minute bar chart we can see
- 39:30how this dueling momentum strategy works
- 39:32this strategy is buying when prices are
- 39:36low but near-term momentums turning
- 39:38higher and it's selling short when
- 39:41prices are high but near-term momentum
- 39:43is turning lower and if we look at a
- 39:46strategy performance report we can see a
- 39:49nice upward sloping Equity curve over
- 39:52the past 10 years this dueling momentum
- 39:55approach in orange juice Futures has
- 39:58performed pretty well for our next
- 40:00strategy entry let's look at using a
- 40:04date trade this is the foundation for
- 40:07trading price seasonals what this
- 40:09strategy does is the strategy will buy
- 40:13if the date crosses over September 1st
- 40:172022 it will do the same thing for 2021
- 40:21and the same thing for
- 40:232020. this is good for a market like
- 40:27corn which is seasonally bullish corn
- 40:30Futures tend to rise in September and
- 40:33October and November during U.S Harvest
- 40:36months we can add a simple bars sense
- 40:39entry exit to this strategy to get a
- 40:42sense for what it looks like on a chart
- 40:45so what this system is doing is again
- 40:47buying corn Futures on September 1st
- 40:512020 on September 1st 2021 and again on
- 40:55September 1st of this year 2022 and
- 40:59exiting that position 90 days later now
- 41:03you might ask why use the date crosses
- 41:06over code instead of just if the date
- 41:09equals September 1st the reason for that
- 41:12is if your September 1st falls on a
- 41:16weekend or a holiday you still want
- 41:18tradestation to pick up a trading signal
- 41:21for the next Open Session by coding if
- 41:24date crosses over September 1st you're
- 41:28allowing tradestation to do that now if
- 41:30you want access to an Excel spreadsheet
- 41:33with a version of this seasonal code
- 41:35that allows you to optimize for getting
- 41:38into a trade before and after a specific
- 41:41date as well as being able to optimize
- 41:43how long to stay in that trade just
- 41:46shoot me an email Insight at
- 41:48peaktradingresearch.com and I will send
- 41:51that over to you for our next strategy
- 41:53entry let's use the day of the week to
- 41:56trade for example let's always go long
- 41:59on Wednesdays what this strategy does is
- 42:02it says if the day of the week is day
- 42:05number two that's Tuesday then buy the
- 42:08next bar at Market that's Wednesday and
- 42:11if the date of the week is number three
- 42:13that's Wednesday set the exit on close
- 42:16so another way to say that is get in on
- 42:18the open on Wednesday get out at the
- 42:21close on Wednesday and if we add this
- 42:24strategy to a soybean daily bar chart we
- 42:28can see how this strategy works the
- 42:31strategy is buying the open on
- 42:33Wednesdays it's getting out on the close
- 42:36on Wednesdays now this strategy worked
- 42:39really well in 2021 and early 2022 when
- 42:44energy markets were rallying you had
- 42:46generally bullish statistics from the
- 42:49Department of energy released on
- 42:51Wednesdays so Wednesday was generally a
- 42:54good day of the week to be long soybean
- 42:56futures for our next strategy entry
- 42:59we're going to be incorporating an
- 43:01external data set to trade now this
- 43:04external data set can be anything that
- 43:07has a date and a value for example it
- 43:10could be the rainfall in Iowa for the
- 43:13past 10 years it could be the value of
- 43:16cash French wheat for the past 10 years
- 43:19or as one of my favorite indicators we
- 43:22can use the commitment of Traders the
- 43:25cot report net hedge fund position for a
- 43:29specific Market this could help us
- 43:31determine if hedge funds the speculators
- 43:34in commodity markets are extended short
- 43:37or they're extended long in a particular
- 43:40market so this is what our strategy
- 43:43entry code that incorporates an external
- 43:46data set looks like for example we will
- 43:49look at a situation in which the hedge
- 43:52fund net long position the hedge fund
- 43:55non-commercial net position is above a
- 43:58value of 20 000 contracts short in that
- 44:01case we are going to look to sell short
- 44:04the next bar at the lowest low of the
- 44:08past two bars stop we're going to look
- 44:10to sell downward momentum if we're above
- 44:12that threshold now tradestation has this
- 44:16non-commercial net position as a code
- 44:19that we can simply enter like this and
- 44:22to make this a realistic complete
- 44:25strategy we'll simply add a line of code
- 44:27that says we will get out if bar sense
- 44:31entry is greater than 10 bars we can now
- 44:34add this external data set strategy to a
- 44:38wheat daily bar chart and trade station
- 44:41and we can see what the strategy is
- 44:43doing it is going short on Lower
- 44:46momentum only if the non-commercial
- 44:50position is above a certain threshold so
- 44:54if hedge funds are extended long in
- 44:56wheat then and only then will this
- 44:59system start trying to sell front month
- 45:02wheat futures for a profit Now Inc
- 45:04incorporating an external data set to
- 45:07trade especially if that data set is
- 45:10based on a fundamental value something
- 45:13like the cash value of a commodity or a
- 45:16supply and demand balance sheet value or
- 45:18a weather value that is increasingly
- 45:21being called Quantum mentals trading
- 45:24that is using a fundamental value as a
- 45:27threshold or a prerequisite for
- 45:30establishing a quantitative trading
- 45:32position if you work for a commodity
- 45:34hedge fund or a big commodity trading
- 45:37house you need to be familiar with this
- 45:39style of quantimentals trading our next
- 45:42strategy entry is a moving average
- 45:45crossover entry and it's the first time
- 45:48that we'll be using variables to
- 45:51establish a trading position a strategy
- 45:53variable is a dynamic value or an
- 45:56equation that we can easily reference
- 45:59later in our strategy and keep the
- 46:02strategy more simple in this case we'll
- 46:04be defining our moving average short
- 46:07variable as the average close of a short
- 46:11length and our moving average long
- 46:14variable as the average close of a
- 46:17longer length if the shorter moving
- 46:19average crosses over the longer moving
- 46:22average than buy next bar at market and
- 46:25vice versa if the shorter moving average
- 46:28crosses under the longer moving average
- 46:31than sell short next bar at market and
- 46:34now we can look at what this strategy
- 46:36looks like on a heating oil daily bar
- 46:40chart we can also add those moving
- 46:42average lines to our chart to really see
- 46:45when they cross over you can see what
- 46:47the strategy is doing when the
- 46:49short-term moving average crosses below
- 46:51the long term the strategy gets short
- 46:53and when the short term crosses up
- 46:55through the long term the strategy gets
- 46:57long and if we look at a performance
- 47:00report that's not too bad for a simple
- 47:03moving average cross silver strategy
- 47:05that is always in the market this moving
- 47:08average crossover approach has done
- 47:11pretty well given the big Market swings
- 47:13that we've seen in heating oil Futures
- 47:15over the past two years so we've walked
- 47:18through nine exceptional systematic
- 47:21strategy entries it's time to look at
- 47:23the goat the greatest of all time
- 47:26strategy entry this is a simple breakout
- 47:29entry that works well across a lot of
- 47:32different markets especially breakout
- 47:34commodity markets like crude oil heating
- 47:37oil gasoline soybeans soybean meal lean
- 47:41Hogs gold and silver so let's look at
- 47:44our goat breakout strategy code there it
- 47:47is this is the greatest of all time
- 47:50strategy entries it's a simple stop
- 47:53breakout it is buying the next bar at
- 47:56the highest high of the past 10 bars on
- 47:59a stop and it is selling short the next
- 48:01bar at the lowest lows of the past 10
- 48:04bars on a stop now you'll often hear
- 48:07Traders talk about stopping out of a
- 48:10position this strategy stops you into a
- 48:13position meaning if the price prints at
- 48:16or above the highest high of the past 10
- 48:19bars this strategy will enter
- 48:21immediately it will not wait to execute
- 48:24at the next bar at Market it will
- 48:26execute immediately and if we add our
- 48:29goat breakout strategy to a gasoline 240
- 48:33minute bar chart we can get a real sense
- 48:35for how this strategy trades if the
- 48:39market is breaking lower and sees the
- 48:42lowest level of the past 10 bars it
- 48:44stops into a short position it gets in
- 48:46immediately and if the market is turning
- 48:49higher and prints the highest level of
- 48:51the past 10 bars the strategy will stop
- 48:54into a long position immediately we can
- 48:57see that this breakout strategy has done
- 48:59a very nice job of catching some of the
- 49:02big swings that we've seen in gas Celine
- 49:05Futures recently and if we look at a
- 49:07longer term performance chart look at
- 49:10that that is a nice upward sloping
- 49:13Equity curve this approach of buying
- 49:15higher highs and selling lower lows with
- 49:18stops has worked exceptionally well over
- 49:21the past decade in gasoline Futures you
- 49:24now have 10 great strategy entries that
- 49:27you can use over and over again to
- 49:29develop some really exceptional
- 49:31systematic trading strategies even more
- 49:34complicated systematic trading
- 49:36strategies with dozens of lines of code
- 49:39and different filters and variables and
- 49:41exits often rely on these very simple
- 49:44strategy entries as the foundation so
- 49:47now let's move on to strategy exits
- 49:51foreign
- 49:53[Music]
- 49:58we talked about the 10 greatest strategy
- 50:01entries and now it's time to cover the
- 50:0410 greatest strategy exits every trading
- 50:07strategy has those two important
- 50:09building blocks entries and exits exits
- 50:12are often overlooked but they are just
- 50:14as important as strategy entries great
- 50:17exits can help you manage risk they can
- 50:19help you lock in profits and overall
- 50:21they can make you a better more
- 50:23confident Trader so the 10 greatest
- 50:26strategy exits let's look at the list as
- 50:29always we'll be looking at some easy
- 50:31language strategy code but Focus Less on
- 50:34the code itself and more on the strategy
- 50:37logic that way if you're using another
- 50:39coding language like python or C plus
- 50:42plus or r or you're doing your work in
- 50:45Microsoft Excel you can still use these
- 50:48exits so let's get started let's look at
- 50:50the greatest of all time strategy exits
- 50:53starting with exit number 10 for the
- 50:56first exit that will be looking at this
- 50:58is a system where your entry is the same
- 51:02as your exit this is a complete trading
- 51:05system that is always long or short the
- 51:08way this strategy works is if the market
- 51:11closed is the highest close of the last
- 51:13six bars then the system will buy the
- 51:15next bar at market and vice versa if the
- 51:18close is the lowest close of the past
- 51:21six bars the system will sell short next
- 51:24part market and again it's a complete
- 51:26system the system is always long or
- 51:28short it's always in the market and we
- 51:30can see what this looks like if we add
- 51:33this strategy to a heating oil 240
- 51:36minute bar chart the system does a nice
- 51:38job of selling short on downward
- 51:41momentum and buying upward momentum
- 51:44selling short on downward momentum if
- 51:47you look at a strategy performance
- 51:48report the system has done fairly well
- 51:51over the past year for just two lines of
- 51:53code always in the market this run up
- 51:56here is Russia as invasion of Ukraine
- 51:58when we saw a lot of volatility and a
- 52:01lot of big breakout moves in heating oil
- 52:03futures for our next trading exit we'll
- 52:06just look at a simple stop loss this is
- 52:09the simplest of all exits and it's a
- 52:12good way to manage risk what this exit
- 52:16does is it says if the system is at any
- 52:19point losing five thousand dollars per
- 52:22contract just exit the position exit the
- 52:24position immediately and if we add this
- 52:28stop loss exit to our goat stop breakout
- 52:31entry that we worked on in our video on
- 52:34strategy entries we can see what this
- 52:37looks like on a chart again the strategy
- 52:39is going short on Lower momentum it's
- 52:42buying upward momentum but we can see
- 52:44that once in a while it's hitting a stop
- 52:46loss and this brings up an important
- 52:48question do you need a stop loss does
- 52:52your system need to have a stop loss not
- 52:55necessarily you can build systems that
- 52:57are always long or short that are always
- 52:59in the market that are always waiting
- 53:01for that next trading signal in the
- 53:03opposite direction to get out of a trade
- 53:05a stop loss will generally help you
- 53:07sleep better at night it's just a nice
- 53:09way to know that if things really go
- 53:11wrong you're gonna get out of a position
- 53:13so bottom line even if adding a stop
- 53:16loss maybe doesn't improve the backward
- 53:18looking Equity curve of your trading
- 53:21system you should still consider adding
- 53:23a stop loss it's a good simple risk
- 53:25management and it makes your trading
- 53:27system more realistic more tradable for
- 53:30our next trading exit we have a simple
- 53:33profit Target like a stop loss this is a
- 53:37simple line of code that will take
- 53:39profit on a position if the total gain
- 53:42is more than ten thousand dollars and if
- 53:46we add our profit Target to our goat
- 53:49entry and add it to a heating oil 240
- 53:53minute bar chart we can see how a profit
- 53:55Target works the system will sell short
- 53:57it's a profit Target go short again hit
- 54:00another profit Target and so on now you
- 54:02might ask why add a profit Target to a
- 54:06trading system why not just let your
- 54:08winners always run there are two reasons
- 54:11for this the first reason is if you look
- 54:14at an equity curve going back through
- 54:16time you'll often find one or two or
- 54:19three really big gains that make up most
- 54:23of the profits over the course of the
- 54:25past 10 years meaning the trading system
- 54:27happened to catch a few big volatile
- 54:30moves like the financial crisis or the
- 54:33covid washout or Russia invading Ukraine
- 54:36and you don't necessarily want to rely
- 54:38on a system that plays for those types
- 54:40of events in the future that you may not
- 54:42catch and adding a profit Target limits
- 54:46the impact of those one-off macro events
- 54:48the second reason is adding a profit
- 54:51Target just makes your system more
- 54:53realistic if your system usually makes
- 54:55gains of a thousand or two thousand or
- 54:58three thousand dollars per contract and
- 55:00all of a sudden you find yourself
- 55:02sitting on a gain of five or six or
- 55:05seven thousand dollars per contract
- 55:06realistically you will probably take
- 55:09profit on that position we all want to
- 55:12say that we're systematic Traders and
- 55:14that will always let our systems run but
- 55:16realistically if you're sitting on a big
- 55:19gain you'll probably take those chips
- 55:21off the table why not code that in why
- 55:23not code in a profit Target our next
- 55:26trading exit is a simple profit Target
- 55:29that executes on the next bar at Market
- 55:33there's nothing really groundbreaking
- 55:35here the only difference is that if your
- 55:38max position profit is greater than your
- 55:41profit Target four thousand dollars per
- 55:43contract five thousand dollars per
- 55:44contract six thousand dollars per
- 55:46contract the system will then exit at
- 55:48the next bar at Market either sell or
- 55:51buy to cover on the next Market Bar an
- 55:54advantage of this approach is that you
- 55:56can take it advantage of the liquidity
- 55:58on the next Market open if you're a
- 56:01larger Trader or if you just want to
- 56:03execute trades once a day if you've
- 56:05built your system to always execute next
- 56:08bar at Market you can use an entry that
- 56:10enters next bar Market with this exit
- 56:12that always executes next bar and Market
- 56:14our next exit is a simple trailing take
- 56:18profit exit this is a great exit what
- 56:22this code is doing is it's saying if the
- 56:24max position profits so the most money
- 56:28that we've ever made on a position minus
- 56:31the open position profit so the current
- 56:33profit that we have at this minute is
- 56:36greater than two thousand so if you've
- 56:39made ten thousand dollars at some point
- 56:40and all of a sudden you're down to only
- 56:42seventy five hundred dollars that's
- 56:44greater than two thousand this system
- 56:46will begin to exit it will sell next bar
- 56:49at Market or it will buy to cover next
- 56:52bar at market and if we combine this
- 56:55with our goat Breakout entry we can see
- 56:58what this looks like on a heating oil
- 57:00240 minute bar chart the system went
- 57:02long on upward momentum and then starts
- 57:05to lose some money so gets out of the
- 57:08position the spread between the most
- 57:10money the system has made and the
- 57:12current money that the system has made
- 57:14is greater than that threshold so the
- 57:16system exits our next exit is a protect
- 57:19profit ratio this is a similar idea to
- 57:23our trailing stop but it's phrased a
- 57:26little bit differently here if the max
- 57:28position profit is greater than a
- 57:30threshold of five thousand dollars per
- 57:32contract the system is long and the open
- 57:35position profit over the max position
- 57:38profit is less than 0.5 so if you've
- 57:42given back 50 percent of your gains then
- 57:44get out of a position vice versa if the
- 57:47market position is short if we add this
- 57:50to a heating oil 240 minute bar chart
- 57:53again we can see how this works the
- 57:55system went short here on Lower moment
- 57:56was making good money then the system
- 57:59got above that profit threshold the
- 58:01market started to revert higher and the
- 58:04system gets out same thing happened here
- 58:06system went short Market starts to
- 58:08revert higher and the system gets out
- 58:10because of this exit all right our next
- 58:12exit is a quick Spike profit exit what
- 58:17this exit does is it says if your Market
- 58:20position is greater than zero if you are
- 58:22long you're selling the next bar at the
- 58:25close plus three percent and if your
- 58:28Market position is less than zero if
- 58:30you're short you're buying to cover at
- 58:32the next bar minus three percent and if
- 58:35we look at what this exit looks like on
- 58:38a chart we can see that when you have a
- 58:41big move quickly in your favor so if
- 58:44you're short and the market spikes lower
- 58:46or you're long and the market spikes
- 58:49quickly higher you are going to exit
- 58:51immediately our next exit is an ATR stop
- 58:55what this code does is it says if you
- 58:58are long and the market starts moving
- 59:01against your position lower as defined
- 59:04by this average true range over the past
- 59:0710 bars times two you want to stop out
- 59:09of your position vice versa if you're
- 59:12short you want to buy to cover if the
- 59:14market starts moving Higher by this ATR
- 59:18times two values so effectively if
- 59:20you're long and the market starts
- 59:21dropping you hop out if you're short and
- 59:23the market starts Rising you also hop
- 59:26out of your position and if we add this
- 59:28to a heating oil 240 minute bar chart we
- 59:32can see how this works here you've
- 59:34established a short position the market
- 59:36starts moving higher you stop out you
- 59:39get into a short position again when
- 59:40momentum starts breaking lower it's a
- 59:42successful trade same thing here you get
- 59:44short it's a successful trade same thing
- 59:47here short successful trade now you're
- 59:49short and the market starts moving
- 59:50against you so you stop out it's a nice
- 59:53way to avoid getting short into an
- 59:56overly uptrending Market two more exits
- 59:58to go this is our reverse exit reverse
- 1:00:02after X bars so if the bars sense
- 1:00:06entries greater than 10 if you've been
- 1:00:08in for 10 bars and you are long then you
- 1:00:11want to go short the next bar on the
- 1:00:13open and if the bar sense entry is
- 1:00:16greater than 10 and you are short then
- 1:00:19you want to buy the next bar on the open
- 1:00:22effectively after 10 bars you want to
- 1:00:25switch directions now this approach will
- 1:00:28generally work well on more mean
- 1:00:30reverting markets a market like cocoa or
- 1:00:34coffee or Nat gas a market that you
- 1:00:36already know tends to trade in the
- 1:00:38sideways pattern this generally will not
- 1:00:41work too well in markets that continue
- 1:00:43to break out because after a certain
- 1:00:45amount of time you're trading against
- 1:00:47momentum for longer Trends so what this
- 1:00:49looks like on a chart we can see here
- 1:00:51we're buying upward momentum via our
- 1:00:54goat entry our goat breakout entry after
- 1:00:5710 bars we're then getting short here we
- 1:01:00are getting short again and then after
- 1:01:0210 bars we are getting long you can see
- 1:01:05it kind of trades in these up down up
- 1:01:07down patterns reversing the position
- 1:01:09every 10 bars now it's time I know
- 1:01:12you're as excited as I am let's look at
- 1:01:15the goat the greatest of all time
- 1:01:18trading exit and there it is exit number
- 1:01:21one exit after a certain number of bars
- 1:01:25this is a Time based exit effectively if
- 1:01:29your bars since entry is greater or
- 1:01:32equal to 20 so if you've been in for 20
- 1:01:34bars just get out you're long you sell
- 1:01:37next bar Market if you're short you buy
- 1:01:39to cover next bar at Market in fact we
- 1:01:42can even clean this up a bit and make
- 1:01:45this one simple line of code now if we
- 1:01:49add our goat stop breakout entry as
- 1:01:52always we can see what this looks like
- 1:01:55on a chart no surprise rise our goat
- 1:01:58entry gets us long on momentum we get
- 1:02:00out after 20 bars again our goat entry
- 1:02:04gets us long and upward momentum and we
- 1:02:06are going to get out after 20 bars so
- 1:02:09when there's no other signal the system
- 1:02:11will always exit after a certain amount
- 1:02:14of time in this case 20 240 minute bars
- 1:02:17now this might be a controversial pick
- 1:02:20for the greatest of all time exit maybe
- 1:02:23you like that trailing stop because it
- 1:02:25helps lock in profits maybe you like
- 1:02:27that reverse exit because if you think a
- 1:02:30trend is over while not reverse and take
- 1:02:32the other direction but believe me you
- 1:02:35will find yourself using this bar sense
- 1:02:37entry exit all the time it's simple it's
- 1:02:40easy to test and Trends only last so
- 1:02:43long it makes sense to strongly consider
- 1:02:46using a time-based exit and keep in mind
- 1:02:49you can layer on different exits it's
- 1:02:52very common to see a strategy have two
- 1:02:55or three or four four different exits
- 1:02:58you can have a stop loss A take profit a
- 1:03:00trailing stop and a bar since entry exit
- 1:03:03all in the same strategy so you now have
- 1:03:0610 great exits in addition to your 10
- 1:03:09great strategy entries you can build
- 1:03:12analyze test and trade thousands of
- 1:03:15different systematic strategies and in
- 1:03:17our next session we are going to look at
- 1:03:20building some real systematic trading
- 1:03:22strategies using some of these simple
- 1:03:25building blocks so on to the next
- 1:03:27session let's build some strategies
- 1:03:32foreign
- 1:03:32[Music]
- 1:03:37s we looked at Great strategy entries
- 1:03:41and great strategy exits and now we're
- 1:03:43going to combine them we're going to
- 1:03:44combine our entries with our exits to
- 1:03:47take a look at some simple but robust
- 1:03:50trading strategies across a diversified
- 1:03:52basket of commodity Futures let's start
- 1:03:55this process by running some tests we're
- 1:03:57going to start by testing five of our
- 1:04:00simple great entries our simple breakout
- 1:04:02or simple mean reversion our low volume
- 1:04:05reversal dueling momentum and the Goat
- 1:04:08the greatest of all time stop breakout
- 1:04:11strategy entry and we'll test those
- 1:04:13strategy entries using all 10 of our
- 1:04:16greatest strategy exits we'll take those
- 1:04:19five strategy entries and 10 strategy
- 1:04:21exits test them across 120 different bar
- 1:04:25sizes ranging from 30 minutes all the
- 1:04:27way up to daily bars and test all that
- 1:04:30across the 25 most liquid us commodity
- 1:04:33markets so overall we're going to run
- 1:04:351.5 million an optimization test to find
- 1:04:39some simple robust systematic trading
- 1:04:41strategies that combine our great
- 1:04:44strategy entries and great strategy
- 1:04:46exits and I'll mention that this
- 1:04:48strategy that we use to test all these
- 1:04:50different exit and entry combinations is
- 1:04:53our Peak Opus strategy and you can find
- 1:04:57the full code for this Opus strategy in
- 1:05:00the course packet available at
- 1:05:03peakalgo.com so let's jump into it let's
- 1:05:06look at some system strategy code
- 1:05:08written in the easy language coding
- 1:05:10language let's look at how these systems
- 1:05:12trade on a chart and then finally let's
- 1:05:15look at some profit statistics for each
- 1:05:17of these five simple robust systematic
- 1:05:21trading strategies our first strategy is
- 1:05:23a simple breakout strategy on lean hog
- 1:05:27240 minute bars what this strategy is
- 1:05:30doing is if the close of one of these
- 1:05:33lean hog 240 minute bars is the highest
- 1:05:36lows of the last 50 then the system will
- 1:05:39buy the next bar at market and vice
- 1:05:42versa if the close is the lowest close
- 1:05:44of the last 50 bars the system will sell
- 1:05:47short next bar market and for the exit
- 1:05:50we're using the reverse after a certain
- 1:05:53number of bars exits so if there's no
- 1:05:56other trading signal and the system is
- 1:05:58long it goes short and if there's no
- 1:06:00other trading signal and the system is
- 1:06:02short then it goes long and of course
- 1:06:04one of the big advantages of this being
- 1:06:06a systematic trading strategy we can
- 1:06:09simply add this trading system to a lean
- 1:06:12hog 240 minute bar chart to really get a
- 1:06:15sense for how the strategy works we can
- 1:06:18see the system is buying higher highs
- 1:06:20it's selling short lower lows and in the
- 1:06:23absence of a system the system will
- 1:06:25simply reverse go long reverse go short
- 1:06:28reverse go long reverse go short so it
- 1:06:31will buy breakouts sell breakouts and
- 1:06:33then trade reversals if there's no other
- 1:06:36signal and if if we look at a strategy
- 1:06:38performance report we see a nice upward
- 1:06:41sloping Equity curve this trading system
- 1:06:44has generated positive profits of about
- 1:06:47a hundred and ten thousand dollars over
- 1:06:49the past 11 years running from 2010 to
- 1:06:52the end of 2021 and that includes the
- 1:06:56realistic costs of slippage and Brokers
- 1:07:00commission to jump into a performance
- 1:07:01summary there it is total net profit a
- 1:07:04hundred and ten thousand dollars with a
- 1:07:06profit factor of 2.23 this is a good
- 1:07:09trading system our next trading system
- 1:07:12is a simple mean reversion strategy on
- 1:07:16Coco daily bars what this system does is
- 1:07:19it says if the close of the Coco Market
- 1:07:22is the highest close of the last 35 days
- 1:07:25then sell short next bar at market and
- 1:07:29if the close is the lowest close of the
- 1:07:32last 35 days then buy next bar at mark
- 1:07:37mean reversion system it's selling short
- 1:07:40higher highs and it's buying lower lows
- 1:07:43and there's a quick Spike profit exit if
- 1:07:46the system is long and the market spikes
- 1:07:49Higher by five percent the system exits
- 1:07:52and if the system is short and the
- 1:07:54market Falls by five percent the system
- 1:07:57exits let's take a look at what this
- 1:07:59system looks like on a chart using Coco
- 1:08:02daily bars you can see that this system
- 1:08:05is doing what we expected it is selling
- 1:08:08short higher highs it is buying lower
- 1:08:11lows it is generally mean reversion
- 1:08:13trading in a pretty tight Channel Coco
- 1:08:16is the world's number one mean reverting
- 1:08:19commodity market so we would expect that
- 1:08:21a mean reversion strategy like this
- 1:08:23would perform pretty well let's look at
- 1:08:25a strategy performance report there we
- 1:08:28go that's a nice upward sloping Equity
- 1:08:31curve this mean reversion approach to
- 1:08:33trading Coco Futures has worked well
- 1:08:36over the past 11 11 years up to 2022 and
- 1:08:40if we look at a performance summary
- 1:08:41there we go sixty thousand dollars in
- 1:08:44profit fifty six thousand to be exact
- 1:08:46with the profit factor of 2.37 again
- 1:08:50another good trading system considering
- 1:08:52we're just using a few lines of code and
- 1:08:55a simple mean reversion trading approach
- 1:08:58our next trading system is a low volume
- 1:09:01reversal on Silver daily bars what this
- 1:09:05system does is it says if volume is
- 1:09:08lower than average and the close is the
- 1:09:11lowest close of the last 35 days then
- 1:09:14buy silver Futures next open at market
- 1:09:17and if volume is low and the close is
- 1:09:20the highest close of the last 35 days
- 1:09:23then sell short silver Futures next day
- 1:09:27at market and for the strategy exit
- 1:09:30there is no specific exit your entry
- 1:09:34acts as your exit what this means is
- 1:09:36that this system is always long or short
- 1:09:39the only time it exits a position is
- 1:09:42when it receives a trading signal in the
- 1:09:45opposite direction and if we add our
- 1:09:47trading system to a silver daily bar
- 1:09:50chart we can see how this system works
- 1:09:53the system is buying lower closes and
- 1:09:56selling short higher closes as long as
- 1:09:59volume is dropping and again what we'll
- 1:10:01notice is because there's no explicit
- 1:10:04exit your entry acts as an exit the
- 1:10:07system is always long or short the
- 1:10:09system always has a position in the
- 1:10:11market and if we bring up a performance
- 1:10:14report there we go another nice upward
- 1:10:17sloping Equity curve this trading system
- 1:10:20has made
- 1:10:21267 thousand dollars over the past 11
- 1:10:25years including the realistic costs of
- 1:10:28slippage and brokerage commission with a
- 1:10:31profit factor of
- 1:10:324.19 again not a bad system considering
- 1:10:37it's only a few lines of code and it's
- 1:10:39always in the market it is always
- 1:10:41trading silver Futures our fourth
- 1:10:43trading system is a dueling momentum
- 1:10:46trading system on copper 360 minute bars
- 1:10:50what the system does is it says if the
- 1:10:52recent Market close is above the close
- 1:10:55from 50 bars ago but it's also below the
- 1:10:59close from a hundred bars ago then buy
- 1:11:01next bar market and vice versa if the
- 1:11:04close is below the close 50 bars ago but
- 1:11:07above the close a hundred bars ago then
- 1:11:09sell short next bar at Market basically
- 1:11:12if short-term momentum is higher but
- 1:11:14long-term momentum is lower than buy and
- 1:11:17if short-term momentum is lower but
- 1:11:19long-term momentum is higher than sell
- 1:11:21short this trading system also has the
- 1:11:24goat the greatest of all time strategy
- 1:11:28exit it's that exit after X bars so if
- 1:11:3150 bars have passed if 5360 minute bars
- 1:11:35have passed and there's no other Trading
- 1:11:37signal simply hop out of the position
- 1:11:39and if we add our dueling momentum
- 1:11:42trading system to a copper 360 minute
- 1:11:46chart we can see how the system works if
- 1:11:49short-term momentum starts to turn
- 1:11:51higher against long-term momentum the
- 1:11:54system buys there's no other signal so
- 1:11:56the system gets out after 50 bars vice
- 1:11:59versa you have momentum turning lower
- 1:12:01here so the system sells short there's
- 1:12:03no other signal so the system buys the
- 1:12:05cover here and if we look at a strategy
- 1:12:08performance report there we go another
- 1:12:10nice upward sloping Equity curve this
- 1:12:13system has made 122 thousand dollars or
- 1:12:16single contract copper traded over the
- 1:12:19past 11 years including the realistic
- 1:12:22cost of slippage in commission with a
- 1:12:24profit factor of 1.7 another good
- 1:12:27trading system and for our fifth and
- 1:12:30final trading system there it is the
- 1:12:32goat the greatest of all time strategy
- 1:12:36entry it's a stop breakout system on
- 1:12:39Cotton daily bars how the system works
- 1:12:42it says if we are seeing the highest
- 1:12:45high of the last 45 days then buy on a
- 1:12:48stop and if we see the lowest low of the
- 1:12:51past 45 days then sell short on a stop
- 1:12:55and this system also has a simple profit
- 1:12:58Target next bar at Market exit so if the
- 1:13:01max position profit on any trade is over
- 1:13:05six thousand seven hundred and fifty
- 1:13:07dollars then get out of the position
- 1:13:09either sell next bar at Market or buy to
- 1:13:11cover next bar at market and if we add
- 1:13:14this strategy to a cotton daily bar
- 1:13:17chart we can get a sense for how it
- 1:13:20works the strategy is selling short
- 1:13:22breaks lower it is buying breaks higher
- 1:13:26and it has a simple profit Target
- 1:13:28looking at a strategy performance report
- 1:13:30we see another nice upward sloping
- 1:13:33Equity curve this system has made 90 000
- 1:13:37dollars over the past 11 years up to
- 1:13:402022 with a profit factor of 2.72
- 1:13:44another good trading system considering
- 1:13:47it's just a few lines of code so there
- 1:13:50it is you have five great robust
- 1:13:52systematic trading strategies based on
- 1:13:55our five greatest strategy entries and
- 1:13:58five great strategy exits you've got a
- 1:14:01simple breakout system in lean Hogs a
- 1:14:03mean reversion system in Cocoa at low
- 1:14:06volume reversal in silver dueling
- 1:14:09momentum and copper and the Goat the
- 1:14:11greatest of all time stop breakout
- 1:14:13trading system in Cotton now are these
- 1:14:16perfect strategies no there's no such
- 1:14:19thing as a perfect trading strategy but
- 1:14:21hopefully these give you a sense for the
- 1:14:23type of robust systematic strategies
- 1:14:26that you can build with simple building
- 1:14:28blocks and the full strategy code for
- 1:14:31all five of these great trading systems
- 1:14:34as well as the Opus code that we use to
- 1:14:37test all of these entry and exit
- 1:14:39combinations is available in the course
- 1:14:42packet at peakalgo.com and now that we
- 1:14:45have some good robust strategies let's
- 1:14:48talk about the best way to turn a good
- 1:14:51strategy into a great strategy and that
- 1:14:55is using filters
- 1:14:59[Music]
- 1:15:03you can turn good systematic trading
- 1:15:06strategies into great systematic trading
- 1:15:09strategies let's back up for a second in
- 1:15:13our last three sessions we looked at
- 1:15:15Great strategy entries and great
- 1:15:18strategy exits we then combined those
- 1:15:21entries and exits to build simple
- 1:15:24profitable robust systematic trading
- 1:15:27strategies across lean Hogs cocoa silver
- 1:15:30copper and cotton but what's the next
- 1:15:33step how can we turn good systematic
- 1:15:36trading strategies into great systematic
- 1:15:39trading strategies strategies that look
- 1:15:41more like real hedge fund caliber
- 1:15:44trading systems and have a much better
- 1:15:47chance of generating big trading profits
- 1:15:49in real time you can do all this with
- 1:15:52entry filters today we'll talk about how
- 1:15:55these filters work and I'll demonstrate
- 1:15:57how you can Implement them into any
- 1:15:59systematic trading strategy when you
- 1:16:02have a very basic trade rating system
- 1:16:04for example a breakout system or a mean
- 1:16:07reversion system or a momentum trading
- 1:16:10system you are following a very simple
- 1:16:12set of rules for example with a simple
- 1:16:15breakout system you are buying higher
- 1:16:18highs and selling short lower lows with
- 1:16:21the hope that on a long enough timeline
- 1:16:23that's a profitable trading approach but
- 1:16:25maybe that's not always the right
- 1:16:27approach maybe there are certain
- 1:16:29scenarios in which you don't want to buy
- 1:16:32higher highs and don't want to sell
- 1:16:34short lower lows what if you could find
- 1:16:36out what those bad situations are what
- 1:16:39if you could use filters to weed out
- 1:16:41those bad trading setups for example
- 1:16:44maybe your simple breakout system
- 1:16:46shouldn't be trying to buy higher highs
- 1:16:49if it's a Friday or if it's before 10 in
- 1:16:52the morning or if trading volumes are
- 1:16:55dropping or if volatility is increasing
- 1:16:57we can test all that we can use filters
- 1:17:00to answer the question should we be a
- 1:17:03avoiding that trading setup the peak
- 1:17:06filters that we'll talk about today test
- 1:17:08hundreds of different Market scenarios
- 1:17:11and price patterns to find what are
- 1:17:13those situations that you might want to
- 1:17:16avoid to increase your system's
- 1:17:18profitability so you get a sense for
- 1:17:20what these filters are how they could
- 1:17:22help us avoid bad trading setups now
- 1:17:25let's look at a practical example for
- 1:17:27the heating oil Market where we can take
- 1:17:29a good breakout trading system and turn
- 1:17:32it into a great breakout trading system
- 1:17:35there are four simple steps that we are
- 1:17:38going to follow first we are going to
- 1:17:40add the peak filter script to our
- 1:17:43strategy next we are going to test the
- 1:17:45entry filters we are then going to
- 1:17:47permanently move the filters into our
- 1:17:50strategy and finally we are going to
- 1:17:52remove the filter script that we added
- 1:17:54earlier so let's jump into tradestation
- 1:17:56and look at a very simple breakout
- 1:17:58strategy for the heating oil Market on
- 1:18:00240 minute bars what this strategy does
- 1:18:03does is it buys higher highs looking
- 1:18:06back at the last 50 bars and it sells
- 1:18:09short lower lows looking also back at
- 1:18:11the last 50 bars the strategy then exits
- 1:18:14so it either sells the position or buys
- 1:18:16to cover that heating oil position using
- 1:18:18a slightly different length the shorter
- 1:18:20length of only 15 bars there's also a
- 1:18:23profit Target of three thousand dollars
- 1:18:25per contract and a stop loss of a fifth
- 1:18:28of that three thousand dollars per
- 1:18:30contract so six hundred dollars per
- 1:18:32contract and if we look at some
- 1:18:34performance statistics we can see a nice
- 1:18:36upward sloping Equity curve so
- 1:18:38cumulative profits have accrued nicely
- 1:18:41over time with very few drawdowns and
- 1:18:43this system has made about a hundred and
- 1:18:46twenty eight thousand dollars including
- 1:18:48slippage and including commission costs
- 1:18:50over the past 10 years so we know we're
- 1:18:52starting with a pretty good breakout
- 1:18:55strategy in heating oil now let's add
- 1:18:57the peak filter script so that we can
- 1:19:00start testing which of those filters we
- 1:19:03ultimately want to add to the strategy
- 1:19:05to make it even better so this is what
- 1:19:07the peak filter script looks like that
- 1:19:10we'll be adding to our strategy what
- 1:19:12we're going to do is take this simple
- 1:19:14script and wrap it around the very first
- 1:19:17entry that we want to test so to do that
- 1:19:20we simply copy the script we paste it
- 1:19:22into our strategy to wrap it around the
- 1:19:26very first entry and now we confirm and
- 1:19:29we are good to go we can now test
- 1:19:31different entry filters on that first
- 1:19:33entry now you'll see in our strategy we
- 1:19:36have a new input called the filter input
- 1:19:39what we're going to do is we are going
- 1:19:40to optimize that new input with a value
- 1:19:43from 1 to 500 to see which of those
- 1:19:47price patterns or Market scenarios we
- 1:19:50should best be avoiding in our strategy
- 1:19:52our optimization is now done running if
- 1:19:55we look at our optimization report and
- 1:19:57sort by net profit we can see that the
- 1:20:00two best filters are number 140 31 and
- 1:20:04number 91 so we've run our optimization
- 1:20:07test across hundreds of different Market
- 1:20:09scenarios and price patterns and it
- 1:20:12tells us that number 91 and number 141
- 1:20:16are the filters that work best those are
- 1:20:19the market scenarios that we want to
- 1:20:21avoid to improve the performance of our
- 1:20:24strategy so let's move on to step number
- 1:20:28three let's find those filters look at
- 1:20:31what they are and move them permanently
- 1:20:33into our breakout strategy code we now
- 1:20:36want to find the strategy code for the
- 1:20:39filters that we're looking for so we go
- 1:20:41to our Peak filter function and remember
- 1:20:44we want to look for Filter Number 91
- 1:20:47there it is if the adx value is greater
- 1:20:51than 30 that is a situation that we want
- 1:20:54our code to avoid so here we write if
- 1:20:5780x greater than 30 equals false and
- 1:21:00next we want to look for the other
- 1:21:01filter that worked well for Forest that
- 1:21:03was number 141 so there it is this is an
- 1:21:07up range filter again we simply copy the
- 1:21:10filter we paste the actual strategy code
- 1:21:12into our strategy as a situation we want
- 1:21:15to avoid so false and we tell our script
- 1:21:18to begin if both of those filters are
- 1:21:21false now if we confirm our strategy we
- 1:21:25can immediately see the impact that this
- 1:21:27has on strategy performance there we go
- 1:21:30we can see our Equity curve looks even
- 1:21:33better this strategy has now made 175
- 1:21:37000 including slippage including
- 1:21:39commission costs instead of the 128
- 1:21:43000 from just the simple code we can now
- 1:21:45repeat this process that we did for the
- 1:21:48buying entry on the selling short entry
- 1:21:51so again we just wrap our testing script
- 1:21:54around the cell short entry we confirm
- 1:21:57our strategy and we're going to optimize
- 1:22:00that same filter value from a value of
- 1:22:04one to five hundred to test those 500
- 1:22:07different Market scenarios and price
- 1:22:09patterns our optimization is now done
- 1:22:12running same process as before we take
- 1:22:14the filters that performed best and we
- 1:22:17simply paste those filters from the
- 1:22:18function into our strategy and confirm
- 1:22:22that strategy now if we jump back into a
- 1:22:26strategy performance report we can see
- 1:22:28that performance continues to improve
- 1:22:30those filters are working we now have an
- 1:22:33even better Equity curve now making a
- 1:22:35little over a hundred and eighty
- 1:22:37thousand dollars over the past 10 years
- 1:22:39now for step number four we can jump
- 1:22:42back into our strategy and remove the
- 1:22:45filter script that we had added earlier
- 1:22:47just to clean things up a little bit if
- 1:22:50we confirm our strategy go look at a
- 1:22:52strategy performance report we can see
- 1:22:55that the strategy is unchanged right
- 1:22:57it's the same performance so we've now
- 1:22:59done a good job of cleaning up our
- 1:23:01strategy to use going forward with those
- 1:23:04new filters so we now have what looks
- 1:23:06like a pretty good systematic trading
- 1:23:09strategy for the heating oil Market we
- 1:23:12took a good simple breakout trading
- 1:23:15strategy and turned it into a great
- 1:23:17filtered breakout strategy this strategy
- 1:23:19looks like a great profitable hedge fund
- 1:23:23caliber breakout systematic trading
- 1:23:26system this back-tested strategy has
- 1:23:29made positive profit including the
- 1:23:32realistic costs of Market slippage and
- 1:23:34brokerage Commissions in 11 of the past
- 1:23:3712 years now the big question here is
- 1:23:41this optimization are we over optimizing
- 1:23:44our trading system by using these
- 1:23:47filters and therefore guaranteeing that
- 1:23:50the strategy will not work very well
- 1:23:52going forward and the answer is not
- 1:23:55really we're not tweaking the inputs and
- 1:23:57over optimizing the inputs of the
- 1:24:00trading system to get that perfect
- 1:24:02backward looking Equity curve we're not
- 1:24:05over optimizing inputs rather we're
- 1:24:07using filters to avoid bad trading
- 1:24:10setups situations in which it's just not
- 1:24:13profitable to establish a trading
- 1:24:16position so we end up trading less but
- 1:24:18the situations where we do trade are
- 1:24:21more profitable trading setups which is
- 1:24:24a pretty good situation to be in and
- 1:24:26something very cool about these filters
- 1:24:29is that these filters will often work
- 1:24:31across a lot of different markets for
- 1:24:34example this exact strategy same code
- 1:24:37same input values same filters also
- 1:24:41works in heating oil in gold in Platinum
- 1:24:45and crude oil that should give you more
- 1:24:47confidence that we've truly taken a good
- 1:24:49breakout trading strategy and turned it
- 1:24:51into a great breakout strategy a
- 1:24:54strategy that works across a lot of
- 1:24:56different markets and if you're
- 1:24:57wondering where you can get this peak
- 1:25:00filter code there is a version of our
- 1:25:04Peak filter code available in the
- 1:25:06strategy package at peakalgo.com and the
- 1:25:10full Peak filter code with hundreds of
- 1:25:13different Market scenarios and price
- 1:25:16pattern filters is available for annual
- 1:25:18subscribers at peakalgo.com so we've
- 1:25:22taken great strategy entries great
- 1:25:25strategy exits we've combined them to
- 1:25:28create some simple robust profitable
- 1:25:31systematic trading strategies and we've
- 1:25:33talked about how you can use entry
- 1:25:36filters to turn those good strategies
- 1:25:38into great strategies so you have a
- 1:25:41really good idea how you can build
- 1:25:43profitable high quality hedge fund
- 1:25:46caliber trading systems now let's move
- 1:25:49on and talk about optimization and how
- 1:25:52we can give our systematic trading
- 1:25:55strategies the best chance of Performing
- 1:25:58well going forward we've now finished
- 1:26:00our section on strategy building blocks
- 1:26:04and we're going to move on to our next
- 1:26:06section on strategy optimization
- 1:26:08incubation and portfolio construction
- 1:26:10everything that we'll go through in the
- 1:26:13next few sessions including the
- 1:26:15correlation spreadsheet from the section
- 1:26:17on portfolio construction as well as all
- 1:26:20the cheat sheets from this section on
- 1:26:22best algo markets to trade are available
- 1:26:25in the course packet at peakalgo.com and
- 1:26:30in terms of our overall systematic
- 1:26:32trading strategy development process we
- 1:26:35are going to cover a lot of ground in
- 1:26:38these next sessions we'll be talking
- 1:26:39about testing and optimization real-time
- 1:26:42incubation and portfolio and risk
- 1:26:45analysis let's move on to our next full
- 1:26:48section optimization incubation and
- 1:26:51portfolio Construction
- 1:26:54foreign
- 1:26:55[Music]
- 1:27:00we've now covered entries exits filters
- 1:27:03those fundamental building blocks of
- 1:27:05successful systematic training
- 1:27:07strategies let's move on and talk about
- 1:27:10optimization specifically some of the
- 1:27:13pitfalls of optimization and the steps
- 1:27:15that we can take to avoid them now what
- 1:27:18is optimization optimization is changing
- 1:27:21a trading system to make it more
- 1:27:23effective to make it more profitable and
- 1:27:26for systematic trading that means
- 1:27:28testing the strategies inputs to see if
- 1:27:31that improves strategy performance and
- 1:27:34in the book design testing and
- 1:27:36optimization of trading systems the
- 1:27:39author Robert Pardo says the goal of
- 1:27:41optimization is to find the values for
- 1:27:44model parameters that will generate Peak
- 1:27:46trading performance in real time that's
- 1:27:49a really important distinction that
- 1:27:51we're going to come back to again and
- 1:27:53again in this session the goal of
- 1:27:55optimization is not to create the
- 1:27:58perfect trading system of the perfect
- 1:28:00upward sloping Equity curve the goal is
- 1:28:03to find a set of parameters that best
- 1:28:05sets your strategy up to perform well
- 1:28:08and generate profits in real time now
- 1:28:11how can we do that and what does good
- 1:28:13optimization look like if you are using
- 1:28:16a professional systematic trading
- 1:28:18platform like tradestation multi-charts
- 1:28:21metatrader trading view system parameter
- 1:28:24optimization is always a very
- 1:28:27straightforward process if we jump into
- 1:28:29the trade station trading platform we
- 1:28:32can look at a simple breakout strategy
- 1:28:35for the gasoline market and the first
- 1:28:37thing we'll notice is that there are
- 1:28:39four inputs four parameters at the very
- 1:28:42top of the strategy that we can optimize
- 1:28:45there's a length for buying the market a
- 1:28:48length for selling short the market a
- 1:28:50stop value and a bars sense entry exit
- 1:28:54value and if we add this trading system
- 1:28:56to a gasoline daily bar chart we can see
- 1:28:59that this breakout trading system has
- 1:29:02worked pretty well for the gasoline
- 1:29:04Futures Market it successfully sold
- 1:29:06short lower lows it's been buying higher
- 1:29:09highs for a profit and if we look at a
- 1:29:11strategy performance report we see a
- 1:29:14nice upward sloping Equity curve this is
- 1:29:17generally been a profitable approach to
- 1:29:19trading the gasoline Market but what if
- 1:29:22we want to try and improve this strategy
- 1:29:24performance what if we want to test if
- 1:29:27maybe buying the highest close of the
- 1:29:29last 12 days or 15 days or 20 days could
- 1:29:33improve our strategy performance to do
- 1:29:36that we'll simply jump into the strategy
- 1:29:39and we're going to do this again in
- 1:29:41tradestation but this is the same
- 1:29:43process regardless of the automated
- 1:29:45trading platform that you're using we go
- 1:29:48to our parameters our inputs and we can
- 1:29:51optimize for example we can test this
- 1:29:53from a value of 5 to 15 in increments of
- 1:29:57one and we can test our other length in
- 1:29:59increments of 5 from 25 to 75. our
- 1:30:03strategy optimization is now done
- 1:30:06running if we look at a strategy
- 1:30:08performance report we see a nice upward
- 1:30:10sloping Equity curve a slightly improved
- 1:30:13Equity curve and if we go to a strategy
- 1:30:16optimization report we can see that this
- 1:30:19report tells us if we sort by net profit
- 1:30:22that buying an eight day breakout so
- 1:30:25buying the highest close of the past
- 1:30:27eight sessions and selling short the
- 1:30:30lowest close of the past 75 sessions is
- 1:30:33actually the best parameters to use
- 1:30:36again instead of using 10 here using 8
- 1:30:39and instead of using 50 here for our
- 1:30:42strategy optimization report using a
- 1:30:44value of 75. now that we've done our
- 1:30:46optimization the million dollar question
- 1:30:49what will be the best parameters to use
- 1:30:52going forward now our optimization test
- 1:30:54told us that using 8 instead of 10 and
- 1:30:5775 instead of 50 were the best
- 1:31:00historical parameters to use but will
- 1:31:03those be the best parameter values for
- 1:31:05Peak strategy performance going forward
- 1:31:08the answer frustratingly is almost
- 1:31:11certainly not that value of 8 and 75
- 1:31:14will most likely not be the most
- 1:31:17profitable values to use for the next 10
- 1:31:19years but our strategy optimization
- 1:31:22report gives us some important Clues as
- 1:31:25to what those most profitable parameters
- 1:31:28might be if we jump back into our
- 1:31:30strategy optimization report sorted by
- 1:31:34net profit we see that for our breakout
- 1:31:37buying entries so again that is our if
- 1:31:40the close is the highest close of length
- 1:31:43x we see that that length x value there
- 1:31:46are a lot of optimized values of eight
- 1:31:49of nine of ten and for the selling short
- 1:31:52side we see 75 65 show up quite a bit
- 1:31:56not so much any values that are in the
- 1:31:59low 50s so for amending our trading
- 1:32:03system we might want to change this
- 1:32:06length y value to something around 70
- 1:32:09but still keep our length x around 10.
- 1:32:12again our optimization report showed us
- 1:32:15that 8 was the optimized value but we
- 1:32:17saw a lot of values that were hanging
- 1:32:19out around 10. now that zone where we
- 1:32:22see the highest optimized profits using
- 1:32:25a length x value of 8 or 9 or 10 and a
- 1:32:29length y value of 65 or 70 or 75 that is
- 1:32:34what's called a global Maxima that's the
- 1:32:37zone that we want to be in that's the
- 1:32:39area that we want to choose our best
- 1:32:42parameters from another way to say that
- 1:32:44same idea is that's a good neighborhood
- 1:32:47to be in if we choose parameter values
- 1:32:50of 10 in 60 or 9 and 75 we're generally
- 1:32:55going to have a system that holds up
- 1:32:57much better going forward than if we
- 1:32:59were to use parameters from outside that
- 1:33:02neighborhood parameters from away from
- 1:33:04the global maximum now optimization is a
- 1:33:07great tool but it comes with a big
- 1:33:10warning and that is it is very easy and
- 1:33:13very tempting to over optimize your
- 1:33:16trading systems when you add lots of
- 1:33:18inputs to a trading system when you
- 1:33:21optimize those inputs again and again
- 1:33:23across hundreds or thousands of
- 1:33:26different optimization runs you are over
- 1:33:28optimizing you are curve fitting and
- 1:33:31whether you intend to or not you are
- 1:33:34ensuring that your trading system will
- 1:33:36not work well going forward there are
- 1:33:40real diminishing returns to optimizing
- 1:33:42your trading systems and that point
- 1:33:45where there's no marginal advantage to
- 1:33:47playing around with your inputs and
- 1:33:49doing more optimizations is a lot closer
- 1:33:52than you might think for a great analogy
- 1:33:55about optimization and the hazards of
- 1:33:58over optimization let's talk about
- 1:34:00surfing if you want to learn to surf and
- 1:34:03you go to Hawaii or Bali or California
- 1:34:07your surfing instructor is going to set
- 1:34:09you up with a basic set of rules for how
- 1:34:12to ride a wave and on your first day you
- 1:34:15go out you have a great time you catch a
- 1:34:18few waves and at the end of the day you
- 1:34:20recall okay I caught my best waves at 12
- 1:34:2319 at 123 and at 2 49. and if you go out
- 1:34:28on your second day at exactly those
- 1:34:31times expecting to catch those same
- 1:34:34Great Waves you are not going to have a
- 1:34:37very good time you would be better off
- 1:34:39following that simple set of rules again
- 1:34:42and again that your instructor told you
- 1:34:44now of course the reason you didn't have
- 1:34:47a good second day of Surfing is you over
- 1:34:50optimized you wrongly assume that
- 1:34:52following a very specific set of
- 1:34:54parameters would give you a better
- 1:34:56surfing experience than just following a
- 1:34:59simple set of rules now this is a great
- 1:35:02analogy because markets move in waves
- 1:35:04and you can catch those waves you can
- 1:35:07capture those Market moves for a profit
- 1:35:10if you follow a simple set of
- 1:35:12instructions don't let great be the
- 1:35:14enemy of the good don't ruin a good
- 1:35:17trading system by trying to make it a
- 1:35:20perfect trading system so how can you
- 1:35:23avoid over optimization how can you
- 1:35:25avoid the hazards of curve fitting first
- 1:35:28keep your strategies simple your biggest
- 1:35:31Advantage is being able to trade a
- 1:35:34portfolio of good uncorrelated real-time
- 1:35:37systematic trading strategies that is
- 1:35:40such an important point that comes up
- 1:35:42again and again in this course I'm gonna
- 1:35:45say it again your biggest Advantage as a
- 1:35:48systematic Trader especially in
- 1:35:50commodity markets is being able to trade
- 1:35:53a diversified portfolio of uncorrelated
- 1:35:57real-time trading systems so again spend
- 1:36:01your time trying to find good trading
- 1:36:03systems across more markets especially
- 1:36:07uncorrelated markets like commodity
- 1:36:09markets instead of trying to build that
- 1:36:11perfect over optimized curve fitted
- 1:36:14trading system the second way to avoid
- 1:36:17over optimization is to use more
- 1:36:20out-of-sample data out of sample data is
- 1:36:23data that your strategy has not had
- 1:36:26access to historical data that your
- 1:36:28system has not yet seen and a popular
- 1:36:31way to test on out-of-sample data is
- 1:36:34called walk forward testing now walk
- 1:36:37forward testing is where for example you
- 1:36:40optimize your strategy parameters for a
- 1:36:44very limited period of time for example
- 1:36:46from 2011 to 2015 then you see how those
- 1:36:51parameters perform on a period after
- 1:36:54that for example
- 1:36:562016. you then repeat that process over
- 1:36:59and over again so that you're constantly
- 1:37:02seeing if the parameters that you tested
- 1:37:05for in the past have a predictive value
- 1:37:08for positive performance in the future
- 1:37:11now obviously you can do this process
- 1:37:14manually you could just load up a very
- 1:37:16specific window of time in your trading
- 1:37:19platform optimize see how those
- 1:37:22parameters work on a period after that
- 1:37:24and repeat that process over and over
- 1:37:27again there are also walk forward
- 1:37:29testing engines in most automated
- 1:37:31trading platforms and if you're a
- 1:37:33tradestation user there's a great walk
- 1:37:36forward testing tool that you can use
- 1:37:38called multi-op that you can find at
- 1:37:41multi-op.net and if you don't want to go
- 1:37:43down the full walk forward route you can
- 1:37:45also just optimize your parameters on a
- 1:37:48limited set of data for example you can
- 1:37:51optimize your trading system parameters
- 1:37:53from 2010 to 2020 and then see how those
- 1:37:57parameters perform on real-time data
- 1:38:00data your strategy has not yet seen from
- 1:38:032020 after the third and final way to
- 1:38:07avoid over optimization is to make sure
- 1:38:09that your trading system is consistent
- 1:38:12with your understanding of Market
- 1:38:14participants and how the market moves
- 1:38:17for example if you have a seasonal
- 1:38:20trading system that sells short corn
- 1:38:22Futures in June or July after that
- 1:38:26critical production window when Harvest
- 1:38:28ramps up and Farmers start to get more
- 1:38:31confidence in the final size of their
- 1:38:33crop and Traders remove a risk premium
- 1:38:36from Futures you do not have as much
- 1:38:38risk of over optimizing that trading
- 1:38:41system you don't need to add a lot of
- 1:38:43inputs you don't need to tweak those
- 1:38:45inputs you have the confidence that you
- 1:38:48understand fundamentally why that trade
- 1:38:50works or maybe you use commitment of
- 1:38:52Traders positioning data to trade or
- 1:38:55whether or cash basis the more you
- 1:38:58understand how Market works and how you
- 1:39:01can Model A Trading System around that
- 1:39:04the less likely you are to have to over
- 1:39:06optimize a trading system to get the
- 1:39:09kind of performance statistics that you
- 1:39:11want so putting it all together
- 1:39:13optimization is a powerful tool but that
- 1:39:16optimization button is the devil's
- 1:39:19button it can get you into a lot of
- 1:39:21trouble there is always a real risk of
- 1:39:24over optimization of curve fitting and
- 1:39:27we can avoid some of those risks by
- 1:39:29thinking like a surfer by trying to
- 1:39:32catch waves using a simple set of rules
- 1:39:35by being smart about how we use out of
- 1:39:38sample data and finally trying to build
- 1:39:40our simple systems based on a
- 1:39:43fundamental understanding of how markets
- 1:39:46work and remember I'll say it a third
- 1:39:48time your advantage as a systematic
- 1:39:51Trader is not in building that one
- 1:39:54perfect over optimized trading system
- 1:39:57it's in creating a portfolio Leo of
- 1:40:00Diversified real-time uncorrelated
- 1:40:04systematic trading strategies
- 1:40:09[Music]
- 1:40:13some commodity markets are way better to
- 1:40:16trade than others commodity markets all
- 1:40:18move in very different ways in response
- 1:40:21to different fundamental and
- 1:40:23non-fundamental price drivers especially
- 1:40:25if you are a beginner to systematic
- 1:40:27trading with limited capital or limited
- 1:40:30risk tolerance it is very important to
- 1:40:33know these differences some markets are
- 1:40:35too expensive to trade they have too
- 1:40:37much slippage some commodity Futures
- 1:40:40contracts are really large Futures
- 1:40:42contracts so they require a lot of
- 1:40:44capital and margin to trade some
- 1:40:46contracts are very volatile and have a
- 1:40:48lot of what's called value at risk and
- 1:40:51finally some commodity markets are way
- 1:40:53better for breakout trading and some are
- 1:40:56better for mean reversion trading so
- 1:40:58let's talk about quantitatively how we
- 1:41:01can prove which commodity markets are
- 1:41:03the best for trading and why for example
- 1:41:06you might want to avoid trading markets
- 1:41:09like Palladium and gold and favor
- 1:41:11trading markets like sugar and platinum
- 1:41:14what are the best commodity markets to
- 1:41:16trade let's start by talking about
- 1:41:18slippage slippage is the cost of
- 1:41:21executing a Futures trade when you trade
- 1:41:24commodity Futures there is always a bid
- 1:41:27ask spread there's always a cost to
- 1:41:30executing that trade and every commodity
- 1:41:33Market is different every Market has a
- 1:41:35different amount of slippage a different
- 1:41:37cost you're going to pay to execute a
- 1:41:40trade and most of that has to do with
- 1:41:42liquidity really liquid markets have low
- 1:41:46slippage really illiquid markets with
- 1:41:48fewer participants less volume traded
- 1:41:51have very high slippage very high cost
- 1:41:53to trade for example illiquid markets
- 1:41:56like Lumber or orange juice or Palladium
- 1:41:59or Rice have very few participants not a
- 1:42:03lot of volume a large amount of slippage
- 1:42:05you're going to pay a lot to execute a
- 1:42:08trade but bigger markets like gold
- 1:42:10Platinum copper crude oil have lot of
- 1:42:13Market participants a lot of liquidity a
- 1:42:16low amount of slippage a low cost to
- 1:42:19trade so it follows that when you
- 1:42:21include the cost of slippage in your
- 1:42:24system development which you always
- 1:42:26should include you are going to find it
- 1:42:28easier to build systems for those more
- 1:42:31liquid markets this is one of my
- 1:42:33personal biggest pet peeves with
- 1:42:36strategy development is when I see
- 1:42:38Traders Traders not including those
- 1:42:41costs of slippage and commissions when
- 1:42:43they are building strategies testing
- 1:42:46strategies sharing strategies via email
- 1:42:48or YouTube at Peak trading research we
- 1:42:51will always include those costs of
- 1:42:54slippage and commissions because you
- 1:42:56cannot avoid those costs they are a
- 1:42:58realistic part of trading if your system
- 1:43:01doesn't look good when you include
- 1:43:02slippage and commission costs guess what
- 1:43:05you should not be trading that system it
- 1:43:07will not make money for you in real time
- 1:43:09every system that we build on this
- 1:43:12channel on the Peak trading research
- 1:43:14channel will always include slippage and
- 1:43:17commission costs for example from our
- 1:43:19strategy of the month videos including
- 1:43:22the realistic costs of slippage and
- 1:43:24commissions including the realistic cost
- 1:43:27of slippage and commissions and that
- 1:43:30includes most importantly includes the
- 1:43:33realistic costs of slippage and
- 1:43:36commissions you get the idea always
- 1:43:39include slippage and commission costs
- 1:43:41when you are developing strategies so in
- 1:43:44terms of slippage and liquidity what are
- 1:43:48those best markets to trade and what are
- 1:43:50those markets to avoid if we take a
- 1:43:53chart and we model on the y-axis the
- 1:43:57volatility of a Futures Contract and on
- 1:44:00the x-axis we model the slippage as a
- 1:44:04percentage of notional so the cost of
- 1:44:06executing a Futures trade we can see
- 1:44:09very clearly that there are some markets
- 1:44:12that are liquid and volatile those fall
- 1:44:15into that nice green zone in the upper
- 1:44:18left there are other markets that are
- 1:44:20more E-liquid and stable they fall into
- 1:44:23the bottom right part of the chart
- 1:44:25generally speaking you are going to have
- 1:44:27an easier time developing profitable
- 1:44:30systematic trading strategies especially
- 1:44:33breakout and momentum trading strategies
- 1:44:35for the markets that fall into that nice
- 1:44:38green zone the markets in that green
- 1:44:41zone They are volatile they are also
- 1:44:44liquid there's a low cost to execute
- 1:44:47trades a low amount of slippage meaning
- 1:44:49you are getting the best bang for the
- 1:44:52buck you are not going to pay a lot of
- 1:44:54slippage but you're going to get a lot
- 1:44:56of volatility big moves that you can
- 1:44:59profit from now this idea that some
- 1:45:01markets are very volatile and better for
- 1:45:04breakout trading some are less volatile
- 1:45:07and better for mean reversion trading
- 1:45:09that's a concept we are going to come
- 1:45:11back to later in in this section this
- 1:45:14means that just in terms of slippage and
- 1:45:16volatility you are likely going to be
- 1:45:19favoring markets like Nat gas heating
- 1:45:21oil gasoline coffee Platinum sugar
- 1:45:25soybean oil what are the best commodity
- 1:45:27markets to trade let's talk about
- 1:45:30contract size commodity contracts all
- 1:45:33have different notional dollar values
- 1:45:35and those values are always changing
- 1:45:38depending on the value of the underlying
- 1:45:40commodity for example for gold every
- 1:45:44gold Futures Contract references the
- 1:45:47delivery of a hundred troy ounces and
- 1:45:51one ounce of gold is worth two thousand
- 1:45:54dollars so a hundred ounces two thousand
- 1:45:57dollars an ounce every Futures Contract
- 1:45:59of gold is worth two hundred thousand
- 1:46:02dollars that is a big contract which
- 1:46:05means you are going to need to have a
- 1:46:08big trading account that's able to post
- 1:46:10a big amount of initial and maintenance
- 1:46:12margin on the flip side a contract of
- 1:46:16sugar or cocoa or Nat gas is worth about
- 1:46:19twenty thousand dollars so about a tenth
- 1:46:22the value of a contract of gold so as
- 1:46:25you can see there are some big
- 1:46:27differences here so whether you are a
- 1:46:29beginner and have a smaller trading
- 1:46:31account or a limited amount of capital
- 1:46:33or you are a professional CTA portfolio
- 1:46:37manager and you have in the back of your
- 1:46:39head that trading one contract of gold
- 1:46:41is pretty much the same notional
- 1:46:43exposure is trading 10 contracts of oats
- 1:46:47or cocoa is very important to know these
- 1:46:49differences now that is notional dollar
- 1:46:53value but what about risk what if you
- 1:46:56have a very big contract that has low
- 1:46:59volatility or a very small contract that
- 1:47:02has very high volatility how do you
- 1:47:05adjust for that how do you account for
- 1:47:06the differences in risk a really good
- 1:47:09way to do that is to look at Dollar
- 1:47:12standard deviation or value at risk
- 1:47:15what's called VAR now before Peak
- 1:47:18trading research I was a professional
- 1:47:20commodity Trader for Cargill one of the
- 1:47:23world's largest commercial grain trading
- 1:47:25companies I've also traded for a few
- 1:47:28different hedge funds and my risk has
- 1:47:30never been measured in number of
- 1:47:32contracts or notional value it's always
- 1:47:35been measured in VAR value at risk
- 1:47:38basically what is my dollar notional
- 1:47:41exposure times the standard deviation of
- 1:47:45that asset of that commodity future and
- 1:47:48if we were to list commodity Futures in
- 1:47:51terms of VAR in terms of contract risk
- 1:47:55so notional value times standard
- 1:47:57deviation we can see that some contracts
- 1:48:00have huge risk Palladium heating oil
- 1:48:03gasoline these are markets that not only
- 1:48:06have a big notional contract but a lot
- 1:48:09of volatility and of course other
- 1:48:10markets are way at the bottom of the
- 1:48:13scale markets like cattle corn rice
- 1:48:16cocoa lower notional values lower risk
- 1:48:19so especially when you make that
- 1:48:21transition from system building and
- 1:48:23system testing into live trading you
- 1:48:26need to know these differences you need
- 1:48:29to know that some contracts are bigger
- 1:48:31than others require more capital and
- 1:48:33more margin to trade some are more
- 1:48:36volatile than others and those bigger
- 1:48:38more volatile contracts could have an
- 1:48:41outsized influence on the value of your
- 1:48:43portfolio and you might want to trade
- 1:48:46five or six or seven contracts of cattle
- 1:48:49for every contract of gasoline that
- 1:48:52you're trading in another system and
- 1:48:54finally what are the best commodity
- 1:48:56markets to trade depending on the type
- 1:48:59of trading system that you want to run
- 1:49:01some commodity markets are much better
- 1:49:04for breakout trading for momentum
- 1:49:07trading and others are much better for
- 1:49:09mean reversion trading for range Trading
- 1:49:12now how can we know which markets are
- 1:49:15better for breakouts which are better
- 1:49:17for mean reversion we have already seen
- 1:49:19a really good clue when we looked at
- 1:49:21that chart with volatility versus
- 1:49:23slippage some markets like Nat gas and
- 1:49:27heating oil gasoline if you are very
- 1:49:29volatile they are going to be great
- 1:49:31markets to build breakout and momentum
- 1:49:34trading systems other markets like cocoa
- 1:49:38feeder cattle rough rice live cattle
- 1:49:40they are more stable they're going to be
- 1:49:43great for mean reversion and range
- 1:49:45trading now there is another great way
- 1:49:48to prove out this concept that some
- 1:49:51markets are great for breakout trading
- 1:49:53some are great for mean reversion
- 1:49:54trading and that is we can test some
- 1:49:57systems we can test breakout systems we
- 1:50:00can test mean reversion systems and we
- 1:50:02can look at the math we can
- 1:50:04quantitatively see in which markets
- 1:50:06should we be breakout trading and in
- 1:50:08which markets should we be mean
- 1:50:10reversion trading to run this analysis
- 1:50:13to see which markets are the best for
- 1:50:16breakout trading or mean reversion
- 1:50:18trading we tested 85 different bar sizes
- 1:50:22from 30 minutes up to daily bars we
- 1:50:24tested the 25 major U.S Futures markets
- 1:50:28and we ran 1500 different optimization
- 1:50:32runs on each of those bar sizes and
- 1:50:35Futures markets that is a total of 3.2
- 1:50:38million optimization tests what were the
- 1:50:41results of testing those simple breakout
- 1:50:44and mean reversion commodity trading
- 1:50:47strategies markets like gasoline sugar
- 1:50:50heating oil and lean Hogs are great for
- 1:50:54breakout trading whereas markets like
- 1:50:56rice coffee live cattle and cocoa are
- 1:51:00better for mean reversion trading and
- 1:51:02very big picture we can also see that
- 1:51:05there are more markets that are breakout
- 1:51:08markets in general commodity markets
- 1:51:11tend to work well for breakout trading
- 1:51:14there are very few markets only a
- 1:51:16handful that are great for mean
- 1:51:18reversion and range trading now this is
- 1:51:21great because we've confirmed both by
- 1:51:23looking at slippage and volatility and
- 1:51:26also by running millions of optimization
- 1:51:29tests that we can see there are
- 1:51:31quantitatively some markets that are
- 1:51:33truly better for breakout trading and
- 1:51:36others that are better for mean
- 1:51:37reversion trading you might say Dave I
- 1:51:40know we've done a lot of strategy
- 1:51:41building and testing in this course but
- 1:51:44remind me what is a breakout strategy
- 1:51:47and what is a mean reversion strategy
- 1:51:49let's quickly look at a breakout
- 1:51:51strategy for the heating oil market and
- 1:51:54a mean reversion strategy for the rice
- 1:51:56Market if we jump into the trade station
- 1:51:59trading platform we can look at a great
- 1:52:02example of a breakout strategy for the
- 1:52:05heating oil Market this trading system
- 1:52:08at its core is buying higher highs and
- 1:52:11it is selling short lower lows it is a
- 1:52:15breakout strategy because it's a
- 1:52:17systematic trading strategy you can add
- 1:52:19it to a heating oil 180 minute bar chart
- 1:52:23we can see how the strategy acts it is
- 1:52:25buying upward momentum selling short
- 1:52:28downward momentum selling short downward
- 1:52:31momentum and this has been a pretty good
- 1:52:34approach to trading heating oil Futures
- 1:52:37this trading system has made about
- 1:52:40221 thousand dollars in profits on a
- 1:52:44single contract of heating oil traded of
- 1:52:47course including the realistic costs of
- 1:52:50slippage and commissions and now let's
- 1:52:52look at a mean reversion system for the
- 1:52:55rice Market what this trading system is
- 1:52:58doing is it is buying lower closes and
- 1:53:02it is selling short higher closes it is
- 1:53:05doing the opposite of our heating oil
- 1:53:07breakout strategy instead of buying
- 1:53:10higher highs it is selling short higher
- 1:53:13highs and again because it's a
- 1:53:15systematic trading strategy we can see
- 1:53:17how this system behaves on a rough rice
- 1:53:21daily bar chart it is selling highs it's
- 1:53:24getting short at higher levels and it is
- 1:53:26buying lows it is buying lower levels
- 1:53:29it's basically mean reversion trading
- 1:53:31and if we look at a strategy performance
- 1:53:33report there we go another nice upward
- 1:53:36sloping Equity curve this trading system
- 1:53:38is made about sixty three thousand
- 1:53:41dollars per single contract of rough
- 1:53:44rice traded since 2010 of course
- 1:53:47including slippage and commission costs
- 1:53:50to wrap up this section let's back up
- 1:53:53and review what we've talked about some
- 1:53:55commodity markets are much better than
- 1:53:58others for trading we can base that
- 1:54:00conclusion on the size of the contract
- 1:54:03the risk of the contract the bang for
- 1:54:06the buck that you get so the volatility
- 1:54:08in terms of slippage that cost to trade
- 1:54:11and some markets are way better for
- 1:54:14breakout trading like Platinum heating
- 1:54:17oil gasoline and some markets are much
- 1:54:19better for mean reversion trading like
- 1:54:22cocoa like that rough rice trading
- 1:54:24system we went through so overall
- 1:54:26hopefully this gives you a structured
- 1:54:29and quantitative way to think about what
- 1:54:32are the best markets for trading in
- 1:54:35terms of slippage contract size risk and
- 1:54:39finally in which markets is it better to
- 1:54:41do breakout or mean reversion Trading
- 1:54:47[Music]
- 1:54:51you've built your trading system you've
- 1:54:54tested entries and exits and filters
- 1:54:56you've optimized the inputs in that
- 1:54:59trading system you have confidence that
- 1:55:01that trading approach can work well
- 1:55:03going forward it is now time to incubate
- 1:55:06your strategy what is incubation
- 1:55:09incubation is seeing how your systematic
- 1:55:12trading approach Works in real time on
- 1:55:16new unseen data it is putting your
- 1:55:18strategy in a drawer putting it aside
- 1:55:20for six months nine months 12 months
- 1:55:23then revisiting it at a later time to
- 1:55:26see how it's done now incubation is easy
- 1:55:29you simply lock in all your inputs you
- 1:55:32don't touch your strategy you don't
- 1:55:34change anything about it and you just
- 1:55:36see how it performs going forward for a
- 1:55:40practical example on an equity curve of
- 1:55:42what this looks like here is a strategy
- 1:55:45that was developed using data from 2010
- 1:55:48until 2018 it was then eval evaluated on
- 1:55:52new data from 2018 to 2020 and then the
- 1:55:56strategy has been incubating since 2020.
- 1:55:59incubation is important because
- 1:56:01everything that you have done up until
- 1:56:04this point up until today is
- 1:56:06optimization it is curve fitting
- 1:56:09changing the inputs in your strategy to
- 1:56:12try and get better performance
- 1:56:14statistics or an even better upward
- 1:56:16sloping Equity curve is optimization
- 1:56:18choosing which filters to use in your
- 1:56:21strategy is optimization walk forward
- 1:56:24analysis even though it does include
- 1:56:27some out-of-sample data is optimization
- 1:56:30even choosing which strategies to run is
- 1:56:33optimization there is no better way to
- 1:56:36avoid those hazards of over optimization
- 1:56:39that are just a natural part of every
- 1:56:41step of a strategy's development process
- 1:56:44than to incubate your strategy and
- 1:56:46believe me I know how frustrating it is
- 1:56:49especially when you're new to systematic
- 1:56:51Trading things you sit on that strategy
- 1:56:53and incubate it or paper traded for
- 1:56:56three months six months nine months 12
- 1:56:58months to get the confidence that it's a
- 1:57:01strategy that could make money in real
- 1:57:03time now the good news about incubation
- 1:57:05is that sometimes the incubation is done
- 1:57:08for you for example if you find a
- 1:57:11trading system from a book that was
- 1:57:13written years ago or you look at one of
- 1:57:15our strategy of the month videos from
- 1:57:17our Peak trading research YouTube
- 1:57:19channel anything that's after that date
- 1:57:22of publication is incubation it is out
- 1:57:25of sample strategy performance and
- 1:57:28incubation is so important that it is
- 1:57:30one of the core principles behind our
- 1:57:33Peak 10 strategy list at Peak algo.com
- 1:57:36every month we share with our clients
- 1:57:39real fully coded systematic trading
- 1:57:42strategies that have been incubating for
- 1:57:45a minimum of six months because again
- 1:57:48real time out of sample performance the
- 1:57:52gold standard by which you should
- 1:57:54evaluate a trading system now how long
- 1:57:57do you need to incubate a strategy
- 1:57:59obviously the longer the better but a
- 1:58:01minimum of six months if you've been
- 1:58:04incubating a strategy for two years
- 1:58:06three years five years that gives you
- 1:58:09the confidence that this strategy has
- 1:58:11real Edge it is not just a fluke that
- 1:58:14that strategy is generating real profits
- 1:58:17so bottom line incubate your trading
- 1:58:20strategies it will save you a lot of
- 1:58:22headaches a lot of heart breaks and it
- 1:58:25will genuinely improve your systematic
- 1:58:27trading performance
- 1:58:30thank you
- 1:58:35we've talked about entries exits filters
- 1:58:39the importance of optimization and
- 1:58:42incubation so at this point you have
- 1:58:44some great strategies that have a good
- 1:58:46chance of making real profits going
- 1:58:49forward and you even know in which
- 1:58:51markets those strategies will likely
- 1:58:53work best how can we put together all of
- 1:58:57those great strategies into a trading
- 1:59:00portfolio after all as we talked about
- 1:59:02in our session on optimization your
- 1:59:05advantage as a systematic Trader is not
- 1:59:09in building the perfect trading system
- 1:59:11but in putting together a portfolio of
- 1:59:14Diversified real-time trading strategies
- 1:59:17so let's now talk about the number one
- 1:59:20tool for analyzing how to put together
- 1:59:23all of your great trading strategies
- 1:59:25into a portfolio and let's talk about
- 1:59:28the very very good news for
- 1:59:30diversification across commodity markets
- 1:59:34why is diversification education so
- 1:59:36important strategy diversification that
- 1:59:40is treating a Ascot of Diversified
- 1:59:42systematic trading strategies all at the
- 1:59:46same time is important because you are
- 1:59:48less exposed to the volatility and the
- 1:59:52drawdowns From Any Given trading system
- 1:59:55we've spent a lot of time in this course
- 1:59:57looking at Equity curves at those nice
- 2:00:00cumulative profit lines that show the
- 2:00:03historical performance of a systematic
- 2:00:06trading strategy and those Equity curves
- 2:00:08are never a straight line there is no
- 2:00:11Perfect Trading System you are always
- 2:00:14going to have some zigs and some zags
- 2:00:16sometimes when the system is in tune
- 2:00:19with the market in times when the system
- 2:00:21is drawing down diversification across
- 2:00:24many different strategies means that you
- 2:00:27can smooth out the cumulative Equity
- 2:00:29curve of your portfolio when you turn on
- 2:00:33five Diversified trading systems 10
- 2:00:36trading systems 15 20 trading systems
- 2:00:39you will obviously find that your
- 2:00:42cumulative profits go up because you're
- 2:00:44taking more Risk by adding more systems
- 2:00:47but your max drawdowns the times when
- 2:00:50you're not making money as a percentage
- 2:00:53of those returns goes down meaning your
- 2:00:56risk adjusted returns go up you are
- 2:01:00getting more bang for the buck and all
- 2:01:02of those popular risk metrics like your
- 2:01:06kalmar ratio return to draw down Arena
- 2:01:09sharp sortino information ratio all of
- 2:01:13those metrics will improve as you add
- 2:01:16more systematic trading strategy to your
- 2:01:19portfolio what is the number one tool
- 2:01:22for analyzing and maximizing the
- 2:01:25diversification benefits of your
- 2:01:28portfolio and assuring that you're
- 2:01:30getting the best risk returns that is a
- 2:01:33simple correlation Matrix a correlation
- 2:01:36Matrix is a great Foundation it's a
- 2:01:40powerful tool for you to do your
- 2:01:42portfolio diversification analysis we
- 2:01:45are going to go through an example of a
- 2:01:47correlation Matrix here if you want
- 2:01:49access to this full spreadsheet you can
- 2:01:52find it in the horse packet at Peak
- 2:01:55algo.com this correlation table shows
- 2:01:58the correlation between different
- 2:02:01systematic trading strategies based on
- 2:02:03weekly returns over the past 10 years in
- 2:02:07this case these strategies happen to be
- 2:02:09from one of our Peak 10 packages from
- 2:02:12Peak algo.com from earlier this year now
- 2:02:16as a reminder the measure of correlation
- 2:02:18runs from negative one to positive one
- 2:02:22anything from 0 to negative one is
- 2:02:25negatively correlated anything from zero
- 2:02:28to positive one is positively correlated
- 2:02:31now as a rule of thumb a correlation
- 2:02:33value from 0 to
- 2:02:360.25 is a weak correlation a correlation
- 2:02:40from a value of 0.25 to 0.75 is a
- 2:02:45moderate correlation and a correlation
- 2:02:48value from
- 2:02:500.7521 is a strong correlation in an
- 2:02:54ideal world you would want your
- 2:02:56correlation table to show a lot of
- 2:02:58negative correlations meaning the
- 2:03:00strategies are all moving in different
- 2:03:03ways so jumping back to our correlation
- 2:03:06table between these different systematic
- 2:03:09trading strategies the first thing we'll
- 2:03:11notice is that we are off to a pretty
- 2:03:14good start we don't see a lot of really
- 2:03:17strong correlations here in this table
- 2:03:20there's not a lot of values that are
- 2:03:23above
- 2:03:250.5.6.7 in fact the highest correlation
- 2:03:28is between two breakout strategies in
- 2:03:31the metal markets the Ducati strategy
- 2:03:33for platinum and the break the Bank
- 2:03:36strategy for silver which are still only
- 2:03:400.29 correlated that's barely a moderate
- 2:03:43correlation and it's interesting to note
- 2:03:45that the Achilles and non-com Trigger
- 2:03:49strategies both of which are trading the
- 2:03:51lean Hogs Market at LH for the
- 2:03:54continuous contract they have a
- 2:03:56correlation of only
- 2:03:590.09 a very weak correlation right
- 2:04:02around zero this correlation Matrix
- 2:04:05tells us that this is a great basket of
- 2:04:08strategies to trade together our
- 2:04:10correlation Matrix tells us that there
- 2:04:13are not a lot of positively correlated
- 2:04:15strategies which means we are getting a
- 2:04:18lot of diversification benefits from
- 2:04:20Trading all these strategies together
- 2:04:22now this points to one of the biggest
- 2:04:25advantages of systematic trading across
- 2:04:28commodity markets specifically if we
- 2:04:31look at the way that commodity markets
- 2:04:33move the price action across different
- 2:04:36commodity markets will see that they are
- 2:04:39not that correlated the wheat Market
- 2:04:41moves in a very different way than bean
- 2:04:44oil which moves in a very different way
- 2:04:46than coffee than lean Hogs than gasoline
- 2:04:49these markets are all very unique and
- 2:04:52respond to a different mix of
- 2:04:54fundamental and non-fundamental price
- 2:04:57drivers I'll layer on top of that that
- 2:04:59not only do these markets move in very
- 2:05:02different ways but we are trading
- 2:05:04different systems looking at different
- 2:05:07bar sizes different time frames so it
- 2:05:10just makes sense that all of these
- 2:05:13trading systems will naturally move in
- 2:05:15very different ways and that is not the
- 2:05:18case across all markets for example if
- 2:05:21you were only trading stock markets or
- 2:05:24you were only trading interest rates or
- 2:05:26foreign exchange markets stock markets
- 2:05:29are way more correlated to one another
- 2:05:31for example S P 500 the Russell 2000 the
- 2:05:35dial the Nasdaq all tend to move
- 2:05:38together currency markets generally tend
- 2:05:41to move together tend to follow the same
- 2:05:43macro themes or broad Trends in the US
- 2:05:46dollar that is not the case with
- 2:05:48commodity markets and it is a huge
- 2:05:51Advantage for you as a systematic Trader
- 2:05:54this means that if you are trading
- 2:05:56commodity markets diversification is
- 2:05:59naturally on your side and my strong
- 2:06:02opinion here is that it is great to put
- 2:06:05together a correlation Matrix and get a
- 2:06:07sense that your strategies will be
- 2:06:09Diversified and move in different ways
- 2:06:12but don't feel that you need to go much
- 2:06:15beyond that that you need to complicate
- 2:06:17things too much in terms of your
- 2:06:19diversification and risk analysis your
- 2:06:22time is much better spent testing
- 2:06:25strategies incubating strategies versus
- 2:06:28obsessing over all the minute
- 2:06:30differences and correlations between
- 2:06:32your different already Diversified
- 2:06:34strategy again this is a huge advantage
- 2:06:38of commodity markets is that if you are
- 2:06:40trading a number of different systems
- 2:06:43especially if they're across different
- 2:06:45markets diversification is naturally
- 2:06:47already on your side bottom line
- 2:06:50diversification is important because it
- 2:06:53helps the overall risk return profile of
- 2:06:57your portfolio a simple correlation
- 2:07:00Matrix the kind you can find in the
- 2:07:02course packet at Peak algo.com is your
- 2:07:05number one tool for assessing the
- 2:07:08diversification benefits of your
- 2:07:10portfolio and finally if you are trading
- 2:07:13commodity markets you are in a very very
- 2:07:16good place because there are massive
- 2:07:19diversification benefits between your
- 2:07:22different trading systems we've now
- 2:07:24finished our section on optimization
- 2:07:27incubation and portfolio construction it
- 2:07:30is now time to get started with live
- 2:07:33trading in terms of our system attic
- 2:07:36strategy development process we are here
- 2:07:39we are at the top of the mountain the
- 2:07:42top of the strategy development pyramid
- 2:07:44so let's move on to our next and final
- 2:07:46section let's get started
- 2:07:50foreign
- 2:07:51[Music]
- 2:07:55this is the big moment you've built your
- 2:07:59trading system you've tested it you've
- 2:08:01done some gentle optimization maybe
- 2:08:03added some filters you're comfortable
- 2:08:05with the risk of the strategy you've
- 2:08:08incubated this strategy to see how it
- 2:08:11performs in real time on new unseen data
- 2:08:14and you know how this strategy fits into
- 2:08:17your overall portfolio you are now ready
- 2:08:19to pull the trigger and automate your
- 2:08:22trading system so that your automated
- 2:08:24trading platform will execute trades in
- 2:08:28the market on your behalf now this is a
- 2:08:31big step in fact it's the biggest step
- 2:08:34because it's the moment that you
- 2:08:36transition from building and testing
- 2:08:38strategies into becoming a true
- 2:08:41algorithmic Trader the good news is that
- 2:08:43this big step of automating your trading
- 2:08:47systems is actually very straightforward
- 2:08:49regardless of the automated trading
- 2:08:52platform that you're using the
- 2:08:54automation process entails three simple
- 2:08:57Steps step number one is ensuring that
- 2:09:01you are set up to trade the correct
- 2:09:04Futures Contract step number two is
- 2:09:07pressing the automate button step number
- 2:09:09three is confirming that the position
- 2:09:12you hold in the market matches your
- 2:09:15systematic strategy position step number
- 2:09:18three includes rolling your Futures
- 2:09:21Contract through time to ensure that you
- 2:09:24are always trading the correct Futures
- 2:09:26Contract let's start by looking at
- 2:09:29practical examples of what this
- 2:09:31automation process looks like now I'll
- 2:09:34be walking through these examples in the
- 2:09:36tradestation trading platform but
- 2:09:39remember that this automation process of
- 2:09:42mapping the correct contract pressing
- 2:09:44the automate button and confirming that
- 2:09:47your Market position matches your system
- 2:09:49position is the same automation process
- 2:09:52regardless of the trading platform form
- 2:09:55that you use to keep things simple this
- 2:09:58is what tradestation looks like right
- 2:10:00out of the box so if you've never used
- 2:10:03tradestation or another automated
- 2:10:05trading platform this is what it looks
- 2:10:07like when you first open up the platform
- 2:10:10the first thing that we're going to do
- 2:10:12is we are going to open up a chart trade
- 2:10:16station like most other automated
- 2:10:18trading platforms is a chart-based
- 2:10:22trading platform in this case we are
- 2:10:24going to open up a chart for orange
- 2:10:27juice
- 2:10:29180 minute bars let's start with January
- 2:10:331st 2010 exchange time 180 minute bars
- 2:10:37on orange juice and there is our chart
- 2:10:39now for the next step we are going to
- 2:10:43add a strategy to this chart we're going
- 2:10:46to add an orange juice trading strategy
- 2:10:49to our orange juice 180 minute bar chart
- 2:10:53so to start let's jump into trade
- 2:10:56station development environment and
- 2:10:58let's open up a new strategy that we are
- 2:11:02just going to name dueling orange juice
- 2:11:06now we can get rid of this demo text and
- 2:11:10we can paste in the strategy code for
- 2:11:14our dueling momentum strategy for the
- 2:11:17orange juice Market we can now add our
- 2:11:20dueling orange juice strategy to our
- 2:11:23chart to add strategy there's our
- 2:11:26dueling orange juice strategy press OK
- 2:11:29and our systematic trading strategy for
- 2:11:33the orange juice Market has now been
- 2:11:35added to our orange juice chart if we
- 2:11:39look at a strategy performance report we
- 2:11:41should see a nice upward sloping Equity
- 2:11:44curve for this dueling momentum strategy
- 2:11:46for the orange juice market now of
- 2:11:49course importantly we need to take that
- 2:11:51step of ensuring that this is a
- 2:11:53realistic strategy and add
- 2:11:55costs of slippage and commissions enable
- 2:11:59look inside bar testing and let's double
- 2:12:01check this strategy still looks okay
- 2:12:03when we include those costs still works
- 2:12:07still a good strategy for the orange
- 2:12:09juice Market including those realistic
- 2:12:12costs of slippage and commissions so we
- 2:12:15have now brought up an orange juice
- 2:12:17chart we have added our dueling momentum
- 2:12:20strategy to that orange juice chart to
- 2:12:24automate this strategy we need to follow
- 2:12:26that first important step of ensuring
- 2:12:29that we're set up to trade the correct
- 2:12:31orange juice contract now remember that
- 2:12:34all of the strategy building and testing
- 2:12:37that we have done in this course so far
- 2:12:39is always on the continuous contract
- 2:12:43what is a continuous contract as a
- 2:12:46reminder continuous contract for any
- 2:12:49commodity Futures Market is just the
- 2:12:52knit together history of all the futures
- 2:12:55contracts that have come before but it
- 2:12:58is not a real Futures Contract remember
- 2:13:01that commodity contracts are always
- 2:13:04expiring they only last for a limited
- 2:13:07period of time maybe a year or two years
- 2:13:10by using a continuous contract we can do
- 2:13:14long-term historical analysis and
- 2:13:17strategy building to automate our orange
- 2:13:20juice trading system we simply need to
- 2:13:23adjust our chart to not reference The
- 2:13:26Continuous orange juice contract but
- 2:13:28rather the active front month orange
- 2:13:31juice contract to add the active orange
- 2:13:34juice contract to our chart I'm going to
- 2:13:38follow two different steps first I'm
- 2:13:42going to add the continuous contract as
- 2:13:46a second security so we can see it on
- 2:13:50our chart there we go there is the
- 2:13:52continuous contract for orange juice
- 2:13:54with the same price this is the
- 2:13:56continuous contract above I am then
- 2:13:59going to amend that first security so
- 2:14:03that instead of being the continuous
- 2:14:05contract it is the continuous July
- 2:14:09contract now I have a choice here I can
- 2:14:11either use the continuous July contract
- 2:14:14with lots of History going back through
- 2:14:16time or I could simply use the front
- 2:14:19orange juice July contract in this case
- 2:14:22I would only be able to see my strategy
- 2:14:24performance for as long as this July
- 2:14:27contract has been around so I'm going to
- 2:14:30choose to use the continuous front
- 2:14:32orange juice July contract we are now
- 2:14:35good to go we have our continuous July
- 2:14:39orange juice contract loaded on top we
- 2:14:42have our continuous contract for orange
- 2:14:45juice loaded on the bottom here and
- 2:14:47importantly those prices are the same
- 2:14:51this tells me that we are correctly
- 2:14:53using the July contract to trade it
- 2:14:57matches the price for the continuous
- 2:14:59contract that we have used for all of
- 2:15:01our strategy building and testing and
- 2:15:04again as a good double check I can see
- 2:15:07there is the same Equity curve for this
- 2:15:10strategy we have now completed that
- 2:15:13first important step of ensuring that we
- 2:15:16are set up to trade the correct front
- 2:15:19month Futures Contract in the orange
- 2:15:21juice Market let's move on to step two
- 2:15:24which is pressing the automate button
- 2:15:27now we'll be looking at this automation
- 2:15:29process for the tradestation trading
- 2:15:32platform but again it's the same process
- 2:15:35regardless of the trading platform that
- 2:15:38you're using once you have your price
- 2:15:40chart once you have your system loaded
- 2:15:43on that chart and once you have the
- 2:15:45correct contract mapped on that chart it
- 2:15:49is always very straightforward in how
- 2:15:52you can take that next step to automate
- 2:15:54your trading system system regardless of
- 2:15:57the platform you're using let's jump
- 2:15:59back into tradestation and take that big
- 2:16:03step let's automate this trading system
- 2:16:06for the orange juice Market I'm simply
- 2:16:09going to go down to the automation
- 2:16:11section here generate strategy orders
- 2:16:14check it and I want to automate
- 2:16:16execution using my account with account
- 2:16:20confirmation off meaning I don't want
- 2:16:23tradestation to ask me every time I want
- 2:16:26to execute orders I want tradestation to
- 2:16:29execute orders automatically without
- 2:16:32confirmation on my behalf I press OK we
- 2:16:36are up and running this is now a fully
- 2:16:39automated systematic trading strategy
- 2:16:42for the orange juice Market we have now
- 2:16:45taken that big step we've automated our
- 2:16:48orange juice trading system we are
- 2:16:51systematic trading let's now move on to
- 2:16:54step three and confirm that our Market
- 2:16:58position matches our strategy position
- 2:17:01and this is going to be easy in this
- 2:17:03example because when we automated this
- 2:17:06trading system it didn't happen to have
- 2:17:08an open position that should be in the
- 2:17:10market jumping back to our orange juice
- 2:17:13chart in tradestation if we zoom in on
- 2:17:17the chart we can see that this system
- 2:17:19doesn't currently have a position the
- 2:17:22system last went long at the beginning
- 2:17:24of the month got stopped out last week
- 2:17:27and hasn't yet gone long or short orange
- 2:17:30juice Futures now if we jump into a
- 2:17:35trade manager in trade station this is
- 2:17:38what we're looking for we can see that
- 2:17:40our positions match our strategy tells
- 2:17:43us to be flat and our open position in
- 2:17:46the market what we actually hold in our
- 2:17:49brokerage account is also flat meaning
- 2:17:51those positions match but what if that
- 2:17:54were not the case what if we had turned
- 2:17:57on our systematic trading strategy
- 2:18:00knowing that the system had either a
- 2:18:03long or short position in the market
- 2:18:05that we would have to trade to match
- 2:18:08let's jump into tradestation and look at
- 2:18:10a second example of turning on a system
- 2:18:13where there is currently an active
- 2:18:16position there's a silver 360 minute bar
- 2:18:21chart this is a breakout strategy for
- 2:18:24the silver market if we look at a
- 2:18:26strategy performance report we can see
- 2:18:29that this strategy has performed
- 2:18:31relatively well over the past decade
- 2:18:33including the realistic costs of
- 2:18:36slippage and commissions and importantly
- 2:18:39if we jump into the chart and zoom in we
- 2:18:42can see that this system currently has a
- 2:18:46short position in silver Futures the
- 2:18:48system sold this brake lower just last
- 2:18:52weekend holds that short position today
- 2:18:55I've now now added the continuous silver
- 2:18:58contract to this chart I've changed this
- 2:19:01contract one the tradable contract to
- 2:19:04The Continuous July contract so we'll be
- 2:19:07trading July silver Futures confirmed
- 2:19:10that our strategy performance report
- 2:19:13still looks good nice upward sloping
- 2:19:16Equity curve we are ready to again
- 2:19:19automate a strategy go down to strategy
- 2:19:22automation automate executing this
- 2:19:25account I agree with account
- 2:19:27confirmation off we are again
- 2:19:30automatically trading silver Futures in
- 2:19:33the market now using this approach we
- 2:19:36have now automated this trading system
- 2:19:39on July silver Futures but we know that
- 2:19:43the strategy has a short position but we
- 2:19:46don't yet have a short position in the
- 2:19:50brokerage account there it is our
- 2:19:52strategy position is short one contract
- 2:19:55Act of July silver Futures but our open
- 2:19:58position is flat so to amend this to fix
- 2:20:02this we can simply sell one contract of
- 2:20:06July silver Futures at Market there is a
- 2:20:10quick trade bar for July silver Futures
- 2:20:13and we are going to sell one contract at
- 2:20:17market and the nice thing about selling
- 2:20:19that contract is that we have our
- 2:20:22positions now match strategy position
- 2:20:25short one open position short one we are
- 2:20:29matched and if you'd like a deeper dive
- 2:20:31into creating the perfect tradestation
- 2:20:33desktop for monitoring your positions
- 2:20:36and profits you can click our link here
- 2:20:39for the perfect tradestation setup we've
- 2:20:42now gone through two examples both the
- 2:20:44orange juice trading system that didn't
- 2:20:47currently have a position and the silver
- 2:20:49trading system that did have a short
- 2:20:52silver Futures position that both show
- 2:20:55us that pulling the trigger automating
- 2:20:58these trading strategies is actually
- 2:21:01relatively straightforward and after we
- 2:21:03have automated our trading system and
- 2:21:06made sure that our strategy position
- 2:21:09matches our Market position all we have
- 2:21:12to do going forward is make sure that
- 2:21:14our strategy position continues to match
- 2:21:18our Market position and that includes
- 2:21:21rolling contracts through time as a
- 2:21:24different future contracts expire what
- 2:21:27does a contract expiring and a contract
- 2:21:30role look like in tradestation at some
- 2:21:34point in the future this orange juice
- 2:21:36continuous contract price will start to
- 2:21:39reflect September Futures price not the
- 2:21:43July Futures price because the July
- 2:21:45contract will start to lose trading
- 2:21:47volume and it will go off the board
- 2:21:50meaning it's just going to expire and
- 2:21:52lose volume September will become the
- 2:21:55more active contract and at that point
- 2:21:58we will see these prices become
- 2:22:02different so this 250 and 250 suddenly
- 2:22:05The Continuous contract will be a
- 2:22:07different price because it's referencing
- 2:22:09a different new contract it will start
- 2:22:11referencing the September price now the
- 2:22:14good news is is that because we don't
- 2:22:16currently have a position in orange
- 2:22:19juice if we were to see that change
- 2:22:22occur today we would simply amend the
- 2:22:26front contract to be the September
- 2:22:29contract instead of the July contract
- 2:22:31which is just as easy as changing this
- 2:22:34to a u instead of an n and if you need
- 2:22:37to roll a contract for a system where
- 2:22:40you do have a market position for
- 2:22:43example that silver trading system that
- 2:22:46we automated it's not that much more
- 2:22:49complicated you simply need to change
- 2:22:51the contract on your chart to reflect
- 2:22:54the new active contracts so it matches
- 2:22:57the continuous contract price and you'll
- 2:23:00need to roll the actual position that
- 2:23:03you have in the market to match your
- 2:23:06trading system so if you are short one
- 2:23:09contract of July silver Futures you're
- 2:23:12going to have to buy back that short to
- 2:23:14cover that short July position and sell
- 2:23:18one contract of September silver Futures
- 2:23:21this may sound a little bit complicated
- 2:23:24but just think about it as migrating
- 2:23:26both your chart and your position from
- 2:23:29an old contract to a new contract now
- 2:23:33this is one of the most frustrating
- 2:23:35parts of systematic trading for
- 2:23:38commodity Futures specifically remember
- 2:23:41stocks don't have contract rules ETFs
- 2:23:45and cryptos don't have contract roles
- 2:23:47but this is just a part of Futures
- 2:23:50Trading at least for now there is no
- 2:23:53liquid tradable continuous contract you
- 2:23:56will have to roll your contracts Through
- 2:23:58Time both in terms of your chart where
- 2:24:01your system is automated and in terms of
- 2:24:04the actual Futures positions that you
- 2:24:07hold in your account to wrap up this
- 2:24:10session it is a big step and a big deal
- 2:24:13to press that automate button it
- 2:24:16represents not only a huge investment in
- 2:24:19your education and your career but you
- 2:24:22are now a systematic Trader and that is
- 2:24:25something to celebrate you are deploying
- 2:24:28real Capital using real Futures
- 2:24:31contracts using an evidence-based
- 2:24:33systematic approach to trade
- 2:24:38foreign
- 2:24:39[Music]
- 2:24:44we've talked about building strategies
- 2:24:46testing strategies incubating strategies
- 2:24:50so that they have the best chance of
- 2:24:52Performing well and generating profits
- 2:24:54in real time but that said strategies
- 2:24:57can underperform and strategies can
- 2:25:00break experiencing drawdowns and going
- 2:25:03through periods when you're losing money
- 2:25:05instead of making money is unfortunately
- 2:25:08just a realistic part of systematic
- 2:25:11trading the good news is that if you
- 2:25:14anticipate these drawdowns and you have
- 2:25:16a game plan in place for what to do when
- 2:25:19those drawdowns occur it will help your
- 2:25:22confidence it will help you stay in the
- 2:25:24game and ultimately it will help your
- 2:25:27long-term profitability so when should
- 2:25:30you turn off a trading system when is it
- 2:25:34time to quit in this session we'll talk
- 2:25:36about the three steps that you can take
- 2:25:38to best anticipate and manage drawdowns
- 2:25:42when they inevitate occur why do
- 2:25:45strategies break strategies can break
- 2:25:47for a lot of different reasons markets
- 2:25:50change all the time market dynamics
- 2:25:53change around liquidity and trading
- 2:25:56volumes market conditions change around
- 2:25:58supply and demand and Market
- 2:26:00participants change for example in
- 2:26:03agriculture markets in just the last 10
- 2:26:06years we've seen new government biofuel
- 2:26:09mandates we've seen Brazil come online
- 2:26:11as a massive producer of soybeans and
- 2:26:15corn and sugar China is now an
- 2:26:17incredibly important importer of
- 2:26:19agriculture products and there's now
- 2:26:22more money than ever before in
- 2:26:24quantitative strategies that trade these
- 2:26:27markets so a lot has changed across all
- 2:26:30markets and that definitely applies to
- 2:26:32commodity markets as well so a trading
- 2:26:35approach that worked 20 years ago 15
- 2:26:38years ago 10 years ago may not be as
- 2:26:41relevant it may not work as well to
- 2:26:43today and another reason that a strategy
- 2:26:46might break is just because it's over
- 2:26:48optimized all of this strategy inputs
- 2:26:51and variables and filters are so
- 2:26:53specifically tuned to a backward looking
- 2:26:56historical period that it effectively
- 2:26:59guarantees that the strategy will not
- 2:27:01work as well going forward now we've
- 2:27:04talked a lot in this course about the
- 2:27:06importance of incubation so hopefully
- 2:27:08you can avoid some of the pitfalls of
- 2:27:11over optimization but still there is a
- 2:27:14chance that even a well-built strategy
- 2:27:17and incubated strategy can break in real
- 2:27:20time now what does a strategy breaking
- 2:27:23look like let's look at an example from
- 2:27:26stock markets in this case this is a
- 2:27:29strategy that trades S P 500 futures
- 2:27:33based on a few simple criteria if S P
- 2:27:37500 futures are above the long-term
- 2:27:40moving average so if we're still in a
- 2:27:41bull market but short-term momentum is
- 2:27:44defined by RSI and defined by being
- 2:27:47below this shorter term moving average
- 2:27:49is pointing down then the system will
- 2:27:52buy and the system will exit when
- 2:27:54momentum recovers so again long-term
- 2:27:56bull market short-term momentum is
- 2:27:58pointing lower the system buys and the
- 2:28:00system then exits when momentum recovers
- 2:28:03if we look at a chart we can see how
- 2:28:06this system trades it is buying dips so
- 2:28:09it is buying dips whenever the stock
- 2:28:12market dips whenever RSI is low whenever
- 2:28:15we're below some short-term moving
- 2:28:16averages the system buys and then exits
- 2:28:19once momentum has recovered and if we
- 2:28:22look at a strategy performance report we
- 2:28:25see an incredible Equity curve a
- 2:28:28beautiful upward sloping Equity curve on
- 2:28:31S P 500 futures for the period from 2009
- 2:28:35to
- 2:28:362017. Performance summary an
- 2:28:39unbelievable percent profitable 86
- 2:28:41percent profitable so this strategy was
- 2:28:44performing exceptionally well through
- 2:28:47the end of 2017 but what if we extend
- 2:28:51the analysis past the end of 2017. what
- 2:28:55if we bring it out to today we can see
- 2:28:59that pretty much immediately after 2017
- 2:29:02right at the beginning of 2018 there was
- 2:29:05actually an event in the market called
- 2:29:07volmageddon there were a lot of traders
- 2:29:09that were buying dips that were selling
- 2:29:12volatility a lot of short volatility
- 2:29:15ETFs got blown up and this strategy
- 2:29:18began to underperform and has never
- 2:29:21really recovered since there are a few
- 2:29:24reasons that I think this is the perfect
- 2:29:26example of a strategy breaking first of
- 2:29:29all this was a very popular trading
- 2:29:31approach in 2016 and 2017 there were a
- 2:29:35lot of hedge funds a lot of momentum
- 2:29:37ctas that were trading some version of
- 2:29:40this buy the dip RSI s p trading
- 2:29:43strategy second of all this strategy was
- 2:29:46probably over optimized if you look at a
- 2:29:49lot of those inputs they're using very
- 2:29:51specific values which suggest that they
- 2:29:54are optimized to a historical period
- 2:29:57from 2010 to 2016 or 17 and don't really
- 2:30:00reflect what could happen going forward
- 2:30:03and finally something just changed in
- 2:30:06the market that uptrend with free money
- 2:30:08with quantitative easing came to an end
- 2:30:11volatility came back to the market and
- 2:30:14just absolutely wrecked this system but
- 2:30:16it is a great example of a strategy
- 2:30:19breaking of a strategy that was doing
- 2:30:21exceptionally well for a small period of
- 2:30:24time but then just absolutely falling
- 2:30:27apart once the market changed what are
- 2:30:29the three steps that you can take to
- 2:30:32best anticipate and manage strategy
- 2:30:35drawdowns number one is expect that
- 2:30:39drawdowns will happen remember your
- 2:30:42maximum drawdown down is always ahead of
- 2:30:45you there is going to be a point in the
- 2:30:47future where your strategy underperforms
- 2:30:49and there might even be a point where
- 2:30:51that strategy stops working all together
- 2:30:54you should be very pragmatic about the
- 2:30:56strategies that you trade you should not
- 2:30:59fall in love with any given trading
- 2:31:01system remember there is no Perfect
- 2:31:04Trading strategy and from my own
- 2:31:06personal experience the more that I fall
- 2:31:09in love with this strategy the more that
- 2:31:11I'm convinced that this is a strategy
- 2:31:13that will make me money forever the
- 2:31:16higher the probability that it will
- 2:31:18underperform going forward think of your
- 2:31:21strategies as tools for extracting money
- 2:31:25from the market if that tool stops
- 2:31:27working stop using that tool expect and
- 2:31:31anticipate that drawdowns will happen
- 2:31:33number two have a predefined approach
- 2:31:36and a predefined threshold where you
- 2:31:39will turn off an underperforming
- 2:31:42strategy don't don't wait until a
- 2:31:44strategy is losing money to make that
- 2:31:46decision and make sure that you can
- 2:31:48apply that threshold to every strategy
- 2:31:51that you trade for example you do not
- 2:31:54want to say well I'll turn off any of my
- 2:31:56trading strategies if they lose two
- 2:31:58thousand dollars because maybe you have
- 2:32:00strategies that trade different size
- 2:32:03contracts or strategies that have a
- 2:32:05different percentage success rate or
- 2:32:08strategies that trade more often than
- 2:32:10others come up with a generalized
- 2:32:12approach that you can apply to all of
- 2:32:15your trading strategies it will make
- 2:32:17your life a lot easier the best approach
- 2:32:20here that you can apply to all of your
- 2:32:22trading systems is to look at historical
- 2:32:25drawdowns when you build a systematic
- 2:32:28trading strategy when you're testing a
- 2:32:31systematic trading strategy you have
- 2:32:33that nice historical Equity curve you
- 2:32:36can look at historical strategy
- 2:32:38performance so you can always look at
- 2:32:40the maximum drawdown the worst period of
- 2:32:43under performance for that strategy
- 2:32:46historically so a great threshold for
- 2:32:49deciding when to turn off a systematic
- 2:32:52trading strategy is to use 100 of
- 2:32:55historical Max drawdown basically if the
- 2:32:58worst drawdown that your system has ever
- 2:33:01had historically is eight thousand
- 2:33:03dollars per contract and you are
- 2:33:05currently at a loss of eight thousand
- 2:33:07dollars per contract that is a good time
- 2:33:10to turn off that system let's look at an
- 2:33:13example of this idea of a hundred
- 2:33:15percent max historical drawdown if we
- 2:33:18look at a performance report for a live
- 2:33:22cattle 135 minute bar strategy there's a
- 2:33:26nice upward sloping Equity curve but
- 2:33:29this strategy has had a bit of a
- 2:33:31drawdown recently we had a bad trade
- 2:33:34just a few weeks ago we had uh what
- 2:33:36looks like a stop loss and that stop
- 2:33:38loss had a trade loss of about three
- 2:33:41thousand three hundred dollars per
- 2:33:43contract so that means we're seeing a
- 2:33:45bit of a dent in that upward sloping
- 2:33:48Equity curve now if we look at a
- 2:33:50performance summary we can see that the
- 2:33:53max drawdown for this system intraday
- 2:33:55Peak to Valley was twelve thousand
- 2:33:57dollar closed to close for a trade was
- 2:34:00about eleven thousand dollars and if we
- 2:34:02look at a chart we can see where that
- 2:34:03occurred that occurred right here so the
- 2:34:06current drawdown of three thousand
- 2:34:08dollars is a small fraction of the max
- 2:34:11historical drawdown of ten thousand
- 2:34:14dollars so if we were to use that
- 2:34:16hundred percent max historical drawdown
- 2:34:18as a threshold for turning off this
- 2:34:21system we would still have some room
- 2:34:23here we'd be about a third of the way to
- 2:34:25that Max historical drawdown we could
- 2:34:27have two more bad trades that would lose
- 2:34:29three thousand dollars before we'd get
- 2:34:31close to that threshold now why use a
- 2:34:34hundred percent of Maximum historical
- 2:34:36drawdown why not use 75 or 50 the reason
- 2:34:40for that is you want your Thresh told to
- 2:34:43be wide enough so that you give an
- 2:34:45underperforming strategy enough room to
- 2:34:48recover but you also want to recognize
- 2:34:51that maybe that strategy is broken you
- 2:34:53want a threshold that's realistic so
- 2:34:55that you're not losing a hundred percent
- 2:34:58150 percent 200 of your max historical
- 2:35:02drawdown and most importantly find a
- 2:35:04threshold that you are comfortable with
- 2:35:06maybe because of your portfolio size or
- 2:35:09your risk tolerance or the systems that
- 2:35:12you're running maybe you want to use 50
- 2:35:14of Max historical drawdown as your
- 2:35:17threshold and risk that you'll turn off
- 2:35:19systems too early that might recover
- 2:35:22later that is up to you the most
- 2:35:24important concept here is that that
- 2:35:27threshold is a red line just as we've
- 2:35:30spent this whole course talking about
- 2:35:32the importance of automating our
- 2:35:34systematic trading strategies we need to
- 2:35:37recognize the importance of automating
- 2:35:39our portfolio management and automating
- 2:35:42the decision process around turning off
- 2:35:45underperforming strategies have that
- 2:35:48game plan in place stick to it turn off
- 2:35:51that system when it gets past whatever
- 2:35:53threshold you've established the number
- 2:35:56three step for properly anticipating and
- 2:35:59managing drawdowns and turning off
- 2:36:01underperforming trading systems have a
- 2:36:04deep bench have lots of systematic
- 2:36:07trading strategies waiting to be traded
- 2:36:10strategies that are incubating that are
- 2:36:12paper trading that are performing well
- 2:36:14in real time and that can replace any
- 2:36:18underperforming strategies that are
- 2:36:20currently in your portfolio now this is
- 2:36:23the number one question that I get in my
- 2:36:26inbox every single week how to best
- 2:36:29rotate strategies how to replace
- 2:36:32underperforming strategies with
- 2:36:34strategies that are more in tune with
- 2:36:36the current market and because I'm a
- 2:36:39huge soccer fan and I played soccer at
- 2:36:41University I always bring up the example
- 2:36:44of Premier League football English
- 2:36:47Premier League football like a lot of
- 2:36:49other European football leagues
- 2:36:52comprises 20 different teams these are
- 2:36:55the best 20 teams in England but that
- 2:36:58top 20 list is always changing every
- 2:37:01year the bottom three teams in the
- 2:37:04Premier League are relegated they're
- 2:37:07basically demoted down to the next
- 2:37:09League the championship league and the
- 2:37:12top three teams from the championship
- 2:37:14get promoted up to Premier League
- 2:37:17football now I'm sure you can see where
- 2:37:19I'm going with this this is how I think
- 2:37:22about my trading portfolio at Peak
- 2:37:25trading research we are incubating
- 2:37:27hundreds of different systematic trading
- 2:37:30strategies those strategies that are
- 2:37:32performing best that are most in tune
- 2:37:35with the market that are generating
- 2:37:37paper profits including the realistic
- 2:37:40costs of slippage and commissions those
- 2:37:42strategies rise up to become the peak 10
- 2:37:46list that we post monthly at Peak
- 2:37:48algo.com so for my own trading I always
- 2:37:52have a list of strategies right in front
- 2:37:54of me every month via the peak 10 that
- 2:37:57could easily replace any underperforming
- 2:38:01strategies that I'm currently trading so
- 2:38:03whether you are getting new strategies
- 2:38:06from YouTube channels or strategy
- 2:38:08courses or from strategy books or you
- 2:38:11have access to the same list of great
- 2:38:13real-time strategies that I'm looking at
- 2:38:15every month from peakalgo.com you should
- 2:38:18have a deep bench you should have a list
- 2:38:21of strategies that you are ready to
- 2:38:23promote if you want to relegate some of
- 2:38:26your underperforming strategies bottom
- 2:38:29line strategies underperform strategies
- 2:38:32break have a game plan in place for when
- 2:38:35this happens have a predefined threshold
- 2:38:39in place that helps you automate the
- 2:38:41decision process or around when to turn
- 2:38:44off an underperforming strategy and
- 2:38:46finally have a deep bench have a list of
- 2:38:50strategies incubating that are
- 2:38:52performing well in real time that you
- 2:38:54can promote to your portfolio to replace
- 2:38:57those relegated underperforming
- 2:39:00systematic trading strategies following
- 2:39:02these three steps will help you deal
- 2:39:04with drawdowns effectively turn off
- 2:39:07underperforming trading systems and
- 2:39:10improve the long-term performance of
- 2:39:13your portfolio of systematic trading
- 2:39:16strategies
- 2:39:19thank you
- 2:39:23in algorithmic trading psychology still
- 2:39:27matters any systematic Trader who has
- 2:39:30turned on real algorithmic trading
- 2:39:32strategies will tell you that there are
- 2:39:35ups and downs for making and losing
- 2:39:37money in this section we'll talk about
- 2:39:39algorithmic trading psychology some of
- 2:39:42the common pitfalls of algorithmic
- 2:39:44trading and we're going to do that by
- 2:39:46walking through 10 actionable tips that
- 2:39:49you can use to stay in the game used to
- 2:39:51your confidence and improve your
- 2:39:53long-term trading profitability tip
- 2:39:56number one is focus on what you can
- 2:39:59control as a systematic Trader you are
- 2:40:02not making decisions when markets move
- 2:40:05that is what your trading system is set
- 2:40:08up to do and the good news is that that
- 2:40:10system is going to make those decisions
- 2:40:12more quickly and more accurately than
- 2:40:15you ever could now for many algorithmic
- 2:40:17Traders myself included that's a huge
- 2:40:20positive it's a huge relief to not have
- 2:40:23to to be glued to markets all the time
- 2:40:25your role as a systematic Trader is to
- 2:40:29make sure that your system is working
- 2:40:31correctly most importantly that your
- 2:40:33positions match like we talked about in
- 2:40:36the section on getting started that you
- 2:40:38are trading the correct contract and
- 2:40:41that your trading platform is
- 2:40:43consistently connected to the market
- 2:40:45remember that your trading systems are
- 2:40:47set up to make money over the course of
- 2:40:49months and quarters and years not every
- 2:40:53single minute of the day there is no
- 2:40:55trading system that can do that again
- 2:40:57focus on what you can control tip number
- 2:41:01two is trust the process as Larry
- 2:41:04Williams said trading systems work
- 2:41:07system Traders do not if you turn on a
- 2:41:11systematic trading strategy you have
- 2:41:13gone through a lot of steps to get to
- 2:41:15that point you've built this strategy
- 2:41:18optimize the strategy tested it
- 2:41:20incubated it your system is set up to be
- 2:41:23a great Trader and make great decisions
- 2:41:26let it run tip number three is be
- 2:41:29consistent one of the first things that
- 2:41:32I noticed when I started systematic
- 2:41:34trading when I actually turned on real
- 2:41:37trading strategies was how slow it is
- 2:41:40most successful systematic trading
- 2:41:43strategies especially the ones that
- 2:41:45consider the realistic costs of slippage
- 2:41:48and commissions are multi-day or
- 2:41:51multi-week breakout and swing strategies
- 2:41:54this means that even if you are running
- 2:41:56a basket of 20 or 30 or 40 different
- 2:42:00trading systems there might be days that
- 2:42:03you don't have any new trades profitable
- 2:42:06systematic trading is a long haul it's a
- 2:42:09process it can move slower than you
- 2:42:11might anticipate now I love Equity
- 2:42:14curves I love looking at those nice
- 2:42:16upward sloping cumulative profit lines
- 2:42:19the type that we've gone through again
- 2:42:21and again in this course but they can
- 2:42:23and be deceptive remember for those
- 2:42:26Equity curves we're often looking at 10
- 2:42:2812 15 years of data and if you look at
- 2:42:32any Equity curve there are periods of
- 2:42:35months or quarters or sometimes even
- 2:42:37years of underperformance so again be
- 2:42:40consistent and expect that this process
- 2:42:43might take a little longer than you
- 2:42:45first anticipated this tip reminds me of
- 2:42:48one of my favorite tweets that applies
- 2:42:50not just to trading but to life in
- 2:42:53general ninety percent of success can be
- 2:42:55boiled down to consistently doing the
- 2:42:58obvious thing for an uncommonly long
- 2:43:00period of time without convincing
- 2:43:03yourself that you're smarter than you
- 2:43:05are be consistent commit to your trading
- 2:43:08systems and Trust the process tip number
- 2:43:11four is aggressively eliminate the
- 2:43:14things that can go wrong in your trading
- 2:43:17process trading is all about confidence
- 2:43:20and eliminating the things that can go
- 2:43:23wrong will help boost your confidence
- 2:43:25one of the biggest pitfalls here with
- 2:43:28systematic trading is connectivity is
- 2:43:31making sure that your trading platform
- 2:43:33can access the market if you are worried
- 2:43:36about your computer losing power or
- 2:43:38losing its connection to the internet
- 2:43:40you should strongly consider using a
- 2:43:43virtual private server a VPS some great
- 2:43:47virtual private server options include
- 2:43:50Speedy trading servers who I've used
- 2:43:52before and been really impressed with
- 2:43:54there's ovh there's Speedy page all of
- 2:43:58these companies are great Solutions
- 2:44:00they'll offer you 99.9 uptime and most
- 2:44:04importantly a virtual private server
- 2:44:06will give you the confidence that you
- 2:44:09are always connected to the market and
- 2:44:11this idea of eliminating the things that
- 2:44:14can go wrong also applies to your
- 2:44:16trading platform if you find that
- 2:44:18tradestation is missing trades stop
- 2:44:21using tradestation if you find find that
- 2:44:23multi-charts is not mapping contracts
- 2:44:26correctly stop using multi-charts if
- 2:44:29your trading platform is not working for
- 2:44:31you use a different trading platform now
- 2:44:34I'm going to lean in here to properly
- 2:44:36emphasize this next point no matter what
- 2:44:39do not under any circumstance try to
- 2:44:43build your own trading platform the road
- 2:44:46to profitable systematic trading is
- 2:44:49littered with the bones of traders who
- 2:44:52have tried to build their own trading
- 2:44:54platforms you have a lot of great
- 2:44:56options find one that works for you and
- 2:44:59run with it and again to bring back a
- 2:45:01point from earlier in this course your
- 2:45:04advantage your role as a systematic
- 2:45:06Trader is in building a basket of
- 2:45:09uncorrelated systematic trading
- 2:45:12strategies do your best to eliminate
- 2:45:15anything that gets in the way of that
- 2:45:17tip number five is be pragmatic be
- 2:45:20realistic think like a carpenter your
- 2:45:24strategies are tools for making money if
- 2:45:27that tool stops working stop using that
- 2:45:31tool there is no such thing as a perfect
- 2:45:33trading strategy there are no trading
- 2:45:36strategies that are worth falling in
- 2:45:38love with again be pragmatic if your
- 2:45:40strategies are making you money keep
- 2:45:43trading those strategies if they stop
- 2:45:45making you money turn off those
- 2:45:47strategies tip number six follows tip
- 2:45:50number five nicely and that is Define
- 2:45:53your rules and stick to your rules if
- 2:45:55you have written down ahead of time a
- 2:45:58threshold where you will turn off a
- 2:46:00strategy and you get to that threshold
- 2:46:02turn off that strategy and on the flip
- 2:46:05side if you have a strategy position
- 2:46:06that's performing really well and making
- 2:46:09a lot of money don't just take profit on
- 2:46:11that position maybe that position is
- 2:46:13from a strategy that aims to catch big
- 2:46:16breakout moves and maybe that long-term
- 2:46:19Equity curve relies on you catching some
- 2:46:21of those big breakouts moves Define your
- 2:46:24rules ahead of time stick to those rules
- 2:46:27automate your decision-making process
- 2:46:30and trust your systems let your trading
- 2:46:33systems run and believe me I know that's
- 2:46:36easier said than done this is a quote
- 2:46:38from the book trading systems by Urban
- 2:46:40Jackal and Emilio tomassini once you
- 2:46:43have a trading system the biggest
- 2:46:45obstacle is trusting it tip number seven
- 2:46:49is start small and start before you're
- 2:46:52ready you are going to learn so much
- 2:46:55from your first actual live systematic
- 2:46:58strategy trade it is a huge deal to
- 2:47:02start actually trading so do what you
- 2:47:04can to get to that point if that means
- 2:47:07paper trading for a while in a Sim
- 2:47:09account or it means trading a mini
- 2:47:11contract or a contract with a smaller
- 2:47:14notional size do whatever you can to
- 2:47:17take that big step to go from analyzing
- 2:47:20algo strategies to actually Trading algo
- 2:47:24strategies and remember to listen to
- 2:47:26your guts start in a way that you feel
- 2:47:28comfortable with if your portfolio has
- 2:47:31too much volatility or you're up at
- 2:47:33night thinking about any one system or
- 2:47:35any one position pump the brakes a
- 2:47:38little bit remember in the end winning
- 2:47:40is sleeping better tip number eight is
- 2:47:44view algorithmic trading as a project
- 2:47:47view it as an investment in your
- 2:47:49education and your analytical tool set
- 2:47:52if you are connected to markets in any
- 2:47:55way it is a huge deal that you
- 2:47:58understand algorithmic trading the key
- 2:48:01Concepts that you have learned in this
- 2:48:04course around coding strategy building
- 2:48:06risk and portfolio management market
- 2:48:09dynamics have big benefits Beyond just
- 2:48:13the profitability of the trading
- 2:48:15strategies that you're running another
- 2:48:16way to say all this is whether you're in
- 2:48:19economics or Finance or commodity
- 2:48:21markets if you want potential employers
- 2:48:24and Headhunters running to your LinkedIn
- 2:48:28page you need to lean into quantitative
- 2:48:31analysis and algorithmic trading but
- 2:48:34again view all of this as a project as a
- 2:48:37process that is worth investing in tip
- 2:48:40number nine is don't go It Alone find
- 2:48:44other traders that you can talk to and
- 2:48:47find other traders that you can share
- 2:48:49systems with now I used to obsess about
- 2:48:52not sharing systems I used to think that
- 2:48:55I had some proprietary view on the
- 2:48:58market and if I shared it with one or
- 2:49:00two other traders that might lose some
- 2:49:02Edge when I first got into strategy
- 2:49:05development I even hired some coders and
- 2:49:07I'd make them sign ndas so that they
- 2:49:10wouldn't share any of my code elsewhere
- 2:49:12now I have completely gotten over that
- 2:49:15for a few different reasons first of all
- 2:49:17any trading system that you can come up
- 2:49:20with has probably been built before
- 2:49:22there are hedge funds out there that are
- 2:49:24using Quantum Computing to test millions
- 2:49:27of different strategies every year
- 2:49:29they've probably figured out your
- 2:49:31trading strategy and if you do share a
- 2:49:34trading system anyone who looks at that
- 2:49:36system will likely make their own small
- 2:49:38tweaks so it ends up executing in a
- 2:49:41slightly different way than your system
- 2:49:42in the first place Richard Dennis who
- 2:49:45came up with the turtle trading system
- 2:49:47famously said I could publish my rules
- 2:49:49in the newspaper and no one would follow
- 2:49:52them there is so much upside from
- 2:49:54sharing strategies from talking to other
- 2:49:57Traders about what they're doing what
- 2:49:59they're actually trading how they think
- 2:50:01about markets that is so much greater
- 2:50:03than the downside of another Trader
- 2:50:05maybe trading your exact trading system
- 2:50:08in a huge liquid Market it probably
- 2:50:11won't even make a difference bottom line
- 2:50:13don't go It Alone find a network of
- 2:50:16other Traders and don't be afraid to
- 2:50:19share your trading systems tip number 10
- 2:50:22is 5 find your Edge find what you are
- 2:50:26good at find what makes your trading
- 2:50:28different and profitable and really lean
- 2:50:31into that maybe it's structuring
- 2:50:33seasonal trades or finding a unique way
- 2:50:35to analyze commitment of Traders data or
- 2:50:38maybe you work for a big commercial
- 2:50:39Trading Company and you have access to
- 2:50:41private cash data or weather data that
- 2:50:44no one else has access to or maybe you
- 2:50:47like trading those smaller a liquid
- 2:50:49commodity markets like orange juice and
- 2:50:51rice and lumber that most hedge funds
- 2:50:54just don't have access to find your Edge
- 2:50:57find what makes you profitable and lean
- 2:50:59into it there it is there are 10 tips
- 2:51:02that can help your algorithmic trading
- 2:51:04psychology boost your confidence and
- 2:51:07help you avoid some of the pitfalls of
- 2:51:09algorithmic trading
- 2:51:13thank you
- 2:51:17whether you are a professional commodity
- 2:51:20Trader or you are a beginner who
- 2:51:22understands the huge advantages of
- 2:51:25systematic trading there is a lot of
- 2:51:27upside for you in your professional
- 2:51:29development and your trading
- 2:51:31profitability to learn more about
- 2:51:33systematic trading so beyond this course
- 2:51:36let's talk about what are the other
- 2:51:38resources that are out there that are
- 2:51:40available to you specifically books
- 2:51:42strategy testing tools strategy building
- 2:51:45courses and YouTube channels what are
- 2:51:48the best books on algorithmic trading
- 2:51:51these are my top four in order of when
- 2:51:55they were published number one design
- 2:51:57testing and optimization of trading
- 2:52:00systems by Robert Pardo number two
- 2:52:03beating the financial Futures Market by
- 2:52:06Art Collins number three trading systems
- 2:52:09by Urban Jackal and Emilio thomasini and
- 2:52:12number four building winning algorithmic
- 2:52:15trading systems by Kevin Davey all four
- 2:52:18of these books are fantastic resources
- 2:52:21that cover strategy development testing
- 2:52:24optimization risk management portfolio
- 2:52:27construction effectively the building
- 2:52:30blocks for constructing realistic
- 2:52:32systematic trading strategies that have
- 2:52:35the best chance of working well in real
- 2:52:37time what are the most popular
- 2:52:39algorithmic trading strategy courses the
- 2:52:43three courses that I hear of the most
- 2:52:45often are Kevin Davies strategy Factory
- 2:52:48course Andrea Unger's Unger Academy and
- 2:52:52Jeff Swanson's easy language Mastery
- 2:52:55courses now I've taken a few paid
- 2:52:58courses from Kevin Davey I've attended a
- 2:53:01few seminars hosted by Andrea Unger and
- 2:53:04I'm a big fan of Jeff Swanson's blog all
- 2:53:07of these guys have slightly different
- 2:53:09approaches to strategy testing strategy
- 2:53:12walk forwards the use of filters and
- 2:53:15custom bar charts but all three of these
- 2:53:17forces are good options if you want to
- 2:53:20get deeper into systematic trading what
- 2:53:23are the best strategy testing tools the
- 2:53:26top three here are multi-opt which
- 2:53:29follows the same walk forward heavy
- 2:53:31strategy development process taught by
- 2:53:33Kevin Davey the DL pal deep learning
- 2:53:37price action Lab at
- 2:53:39priceactionlab.com it analyzes lots of
- 2:53:42different price patterns to develop
- 2:53:44strategies and finally the build Alpha
- 2:53:47strategy development tool at build
- 2:53:49alpha.com finally what are the best
- 2:53:53YouTube channels this list is very small
- 2:53:56in terms of channels that show actual
- 2:53:58strategy code and realistic Equity
- 2:54:01curves including the cost of slippage
- 2:54:05and commissions it basically comes down
- 2:54:07to Kevin Davey's Channel and the peak
- 2:54:10trading research Channel I can't count
- 2:54:12the number of times that I've seen a
- 2:54:14trading Channel share a beautiful upward
- 2:54:17slope Equity curve with hundreds of
- 2:54:19Trades and then someone inevitably asks
- 2:54:22in the comments well did you include
- 2:54:24commission costs did you include the
- 2:54:26slippage costs of trading that contracts
- 2:54:29so many times and the Creator's answer
- 2:54:32is always inevitably well I didn't but
- 2:54:35it's not that much it's not a big deal
- 2:54:37well if it's not a big deal if it's not
- 2:54:39a big cost included in your development
- 2:54:42process otherwise it's not a realistic
- 2:54:45system this was part of the reason that
- 2:54:47we started our strategy of the month
- 2:54:50videos which have now been running for
- 2:54:52more than a year this is where we show
- 2:54:54fully coded realistic trading systems
- 2:54:58that perform well including the cost of
- 2:55:00slippage and commissions across all
- 2:55:03major agriculture energy and metals
- 2:55:05markets month after month so that's it
- 2:55:08that's the list of strategy books
- 2:55:11strategy testing tools strategy building
- 2:55:14courses and YouTube channels that can
- 2:55:17help you on your journey to profitable
- 2:55:19systematic trading and of course if
- 2:55:22you're interested in fully coded
- 2:55:24systematic trading strategies that are
- 2:55:26performing well in real time you can
- 2:55:29subscribe to our Peak 10 monthly
- 2:55:32strategies at Peak algo.com and you can
- 2:55:35follow Peak trading research on YouTube
- 2:55:38on LinkedIn and on Twitter for commodity
- 2:55:41Market insights and real systematic
- 2:55:43trading strategies bottom line there are
- 2:55:46a lot of great resources out there for
- 2:55:49you and there is no better investment in
- 2:55:52your future career and your trading
- 2:55:54profitability than to learn more about
- 2:55:57algorithmic trading
- 2:56:01thank you
- 2:56:05one final comment to wrap up this 2023
- 2:56:09algorithmic trading course you can do
- 2:56:12this you can build test and automate
- 2:56:15systematic trading strategies to reap
- 2:56:18all the massive advantages of
- 2:56:20evidence-based trading you have the
- 2:56:22building blocks you need the tools you
- 2:56:25need the additional resources you can
- 2:56:27reference and my hope is that this
- 2:56:29algorithmic trading course helps put you
- 2:56:32on a path in terms of your education
- 2:56:34your confidence and your training
- 2:56:37profitability if you have any questions
- 2:56:39or feedback about this course you can
- 2:56:42leave them in the comments below if
- 2:56:44you'd like access to the full
- 2:56:472023 algal course packet you can find it
- 2:56:50at peakalgo.com good luck algorithmic
- 2:56:54trading and we'll see you soon
- 2:56:57thank you
About this transcript
This page contains the full transcript of Peak Algo Trading Full Course | Commodity Market Futures by Peak Trading Research, generated from the public captions YouTube serves with the video. The transcript has 26,532 words across 3,918 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.