YouTube2Text

Peak Algo Trading Full Course | Commodity Market Futures — Transcript

by Peak Trading Research · 26,532 words · 3,918 segments · language en · Watch on YouTube

Full transcript

  1. 0:00you want to start algorithmic trading
  2. 0:03and you understand that there are
  3. 0:04massive advantages in being able to test
  4. 0:07different trading approaches using
  5. 0:09historical data with the goal of being
  6. 0:11able to eventually automate those
  7. 0:13trading systems to execute trades and
  8. 0:16generate profits in real time and
  9. 0:18whether you're an analyst at a commodity
  10. 0:20trading house and you want to use
  11. 0:22algorithms for market analysis or you're
  12. 0:25a Trader at a hedge fund and you want to
  13. 0:27build a portfolio of algorithms to
  14. 0:30complement your current trading approach
  15. 0:32or you're a private Trader looking to
  16. 0:34diversify your Investments with
  17. 0:36commodity Futures you can future proof
  18. 0:39your career you can add an important
  19. 0:41skill set to your resume and Linkedin
  20. 0:44you can become a better more profitable
  21. 0:46more confident Trader there has never
  22. 0:49been a better time to start I'll go
  23. 0:52trading I'm Dave Whitcomb head of
  24. 0:54research for Peak trading research and
  25. 0:56this algo trading course built by the
  26. 0:59commodity special specialist at Peak is
  27. 1:01your number one tool for getting started
  28. 1:04with algorithmic trading in commodity
  29. 1:07markets algorithmic trading also called
  30. 1:10systematic trading or Quant trading or
  31. 1:13as we prefer to call it at Peak
  32. 1:15rule-based trading or evidence-based
  33. 1:18trading it's how the world's most
  34. 1:20successful hedge funds and Traders make
  35. 1:22profits there is a reason that ninety
  36. 1:26percent of Traders don't make money it's
  37. 1:28because technicals don't work most
  38. 1:30Candlestick patterns don't work and
  39. 1:33journaling about your emotions about the
  40. 1:35market doesn't work the good news is
  41. 1:37that you can quickly join the top 10
  42. 1:40percent of Traders and have a much
  43. 1:42better chance of generating real profits
  44. 1:45in real time if you master the
  45. 1:48algorithmic trading Basics that we will
  46. 1:50cover in this course you can think of
  47. 1:52this course as a full University course
  48. 1:56on algorithmic trading for commodity
  49. 1:58market futures but that said all of the
  50. 2:02concepts that we'll be learning are
  51. 2:03applicable to any Market that includes
  52. 2:06stocks bonds FX cryptos the algorithmic
  53. 2:10trading Concepts that we'll be talking
  54. 2:12about are Universal this 2023 course
  55. 2:15comprises 16 different sessions which
  56. 2:18Focus broadly on algorithmic trading
  57. 2:21Basics system building blocks
  58. 2:23optimization incubation and portfolio
  59. 2:26construction and finally getting started
  60. 2:28with live trading now what you are
  61. 2:31watching right now is the full course
  62. 2:33I'm not going to ask you to join some
  63. 2:36slack Channel or Discord or patreon this
  64. 2:39is it this is the full course and you
  65. 2:42don't even need to take notes all of the
  66. 2:45code that we're going to walk through
  67. 2:47all of the cheat sheets and some great
  68. 2:49bonus extras are available in the full
  69. 2:52course packet that you can find at Peak
  70. 2:55algo.com the only thing that I will ask
  71. 2:58is that if you have any questions along
  72. 3:01the way please pop them in the comments
  73. 3:04below this really helps our Channel grow
  74. 3:06and helps us improve future iterations
  75. 3:09of this course so with that algorithmic
  76. 3:12trading full course 2023 let's get into
  77. 3:16it
  78. 3:18foreign
  79. 3:19[Music]
  80. 3:23if you are watching this course you
  81. 3:25likely already know that there are some
  82. 3:28massive advantages to algorithmic
  83. 3:30trading in this section we're going to
  84. 3:32talk about these six main advantages to
  85. 3:35algo trading and why you should stop
  86. 3:37wasting your time and your energy and
  87. 3:40your money on discretionary trading so
  88. 3:43let's jump into it let's start with the
  89. 3:45number one advantage to algorithmic
  90. 3:47trading and that is back testing when
  91. 3:50you trade quantitatively when you trade
  92. 3:52using algorithms you are pre-defining a
  93. 3:56set of rules that you are going to use
  94. 3:58to trade and when you write down your
  95. 4:00strategy logic when you actually code
  96. 4:03that trading system you can then back
  97. 4:05test that system using historical data
  98. 4:08so whether the trading idea that's in
  99. 4:11your head is a breakout approach or a
  100. 4:13mean reversion approach or a seasonal
  101. 4:16trading approach you can test that
  102. 4:18trading approach you can test the
  103. 4:21trading system and if you're using a
  104. 4:22professional trade trading platform like
  105. 4:24tradestation or multi-charts you can add
  106. 4:27that strategy to a chart to see visually
  107. 4:30how the system will trade and you can
  108. 4:32also look at historical performance
  109. 4:34statistics my favorite of which is an
  110. 4:37equity curve so what is an equity curve
  111. 4:40an equity curve shows you your
  112. 4:42cumulative profits that you would have
  113. 4:44generated had you traded this system
  114. 4:47through time for example this Equity
  115. 4:50curve on Coco 128 minute price bars
  116. 4:54shows me that this trading system would
  117. 4:57have made about 85
  118. 5:00000 in cumulative profits since early
  119. 5:032010. if you are a visual learner which
  120. 5:06most Traders tend to be you'll find that
  121. 5:09an equity curve is a really quick way to
  122. 5:12see if a strategy Works a nice upward
  123. 5:15sloping Equity curve shows you that the
  124. 5:17strategy at least historically has made
  125. 5:20money over time without a lot of big
  126. 5:22draw pounds without a lot of periods
  127. 5:25where the strategy did not work so for
  128. 5:27example if you are looking to evaluate a
  129. 5:30strategy that you're getting from an
  130. 5:32external Source like Peak algo.com the
  131. 5:35first thing you're going to want to see
  132. 5:37for that strategy is likely an equity
  133. 5:39curve and you'll also want to know if
  134. 5:42that Equity curve assumes realistic
  135. 5:44slippage and commission costs but bottom
  136. 5:47line that first advantage of algorithmic
  137. 5:50trading is back testing it allows you to
  138. 5:52look at performance statistics to see if
  139. 5:55the strategy works and it allows you to
  140. 5:57see that Equity curve the number two
  141. 5:59advantage to algorithmic trading is that
  142. 6:02you are always in the market your
  143. 6:04systems can always be on you can turn on
  144. 6:07your trading systems so that they are
  145. 6:09always in the market they are always
  146. 6:11looking to take new trades or exit
  147. 6:13trades to manage risk and they're doing
  148. 6:15this with a better attention span and a
  149. 6:18better reaction time than a human ever
  150. 6:20could and this is related to Advantage
  151. 6:23number three and that is your trading
  152. 6:25will become more consistent it doesn't
  153. 6:27matter if you haven't slept well or
  154. 6:29you're having a bad day or you're
  155. 6:31distracted by other things your trading
  156. 6:34systems are always on they will always
  157. 6:36react consistently this means you can be
  158. 6:39far more consistent with how you deploy
  159. 6:42your trading capital and how you manage
  160. 6:44your risk reason number four is better
  161. 6:47diversification if you are discretionary
  162. 6:50trading you are likely glued to your
  163. 6:52screen all the time watching just a
  164. 6:55handful of markets if you are
  165. 6:56algorithmic trading the number of
  166. 6:58trading systems that you can run really
  167. 7:00just depends on your account size your
  168. 7:03capital and how many good trading
  169. 7:06systems you have every Trader is
  170. 7:08different but for me I find that that
  171. 7:10sweet spot is generally around 25 to 30
  172. 7:13trading systems fewer than that and I
  173. 7:16tend to find I don't have a lot of
  174. 7:18active trades at any given time but more
  175. 7:21than that and I tend to kind of lose the
  176. 7:23plot lot but every Trader is different
  177. 7:25maybe you just want to flip on five
  178. 7:28automated trading systems for the energy
  179. 7:30markets and your friend wants to flip on
  180. 7:3250 different trading systems across all
  181. 7:35the different liquid US futures markets
  182. 7:37reason number five is better risk
  183. 7:40management one of the biggest problems
  184. 7:42that discretionary Traders often have is
  185. 7:45taking stops and taking profit you could
  186. 7:48add a stop loss or take profit level or
  187. 7:50a trailing stop to every single one of
  188. 7:53your systematic trading strategies not
  189. 7:55only is this good in risk management but
  190. 7:57it just helps you sleep better at night
  191. 8:00it's a huge Advantage versus
  192. 8:02discretionary trading knowing that you
  193. 8:04can take that human emotion out of
  194. 8:06things reason number six and I cannot
  195. 8:09overstate how important this one is is
  196. 8:12confidence the number one advantage that
  197. 8:15you will notice when you get into
  198. 8:17algorithmic trading is that your
  199. 8:19confidence in your trading approach and
  200. 8:22your trading systems will increase you
  201. 8:25can write down your trading approach you
  202. 8:27can code it up you can back test it you
  203. 8:30can look at a performance report and
  204. 8:31hopefully see a nice upward sloping
  205. 8:34Equity curve for your strategy which
  206. 8:36gives you the confidence that this
  207. 8:38trading approach would have worked for
  208. 8:39the past 10 or 15 or 20 years there is
  209. 8:43nothing that comes close to that in the
  210. 8:46world of discretionary trading you can
  211. 8:48also perform some more advanced
  212. 8:50analytics on your historical strategy
  213. 8:52returns like Monte Carlo analysis walk
  214. 8:55forwards correlation tables you can also
  215. 8:58incubate your strategies you can see how
  216. 9:01your systematic strategies perform by
  217. 9:03paper trading on new unseen data to give
  218. 9:06you the confidence that this strategy
  219. 9:09will probably hold up in real time but
  220. 9:11again the confidence that you can get
  221. 9:13from coding a strategy testing it seeing
  222. 9:16how it would perform in real time this
  223. 9:19is a huge Advantage those are the six
  224. 9:21big advantages of algorithmic trading
  225. 9:24now let's move on and talk about what
  226. 9:27you need to get started with algorithmic
  227. 9:30Trading
  228. 9:33[Music]
  229. 9:37in our last session we talked about the
  230. 9:40big advantages of algorithmic trading
  231. 9:42now let's talk about the things that you
  232. 9:44need to get started with algorithmic
  233. 9:46trading there are four main things that
  234. 9:49you need to get started algorithmic
  235. 9:51trading number one you need a trading
  236. 9:53platform number two you need data that
  237. 9:57that platform can access for system
  238. 9:59analysis or real-time trading number
  239. 10:03three you need a funded brokerage
  240. 10:05account and finally number four you need
  241. 10:08a trading system or preferably a
  242. 10:11portfolio of trading systems in terms of
  243. 10:14finding a good trading platform you have
  244. 10:16a lot of choice between different
  245. 10:18desktop or web-based or mobile trading
  246. 10:21applications in which you can write
  247. 10:23strategy code you can back test that
  248. 10:26strategy code on historical data and you
  249. 10:29can eventually automate the strategy to
  250. 10:31execute Market orders on your behalf
  251. 10:34these are some of the most popular
  252. 10:36trading platform forms and the strategy
  253. 10:39coding language that each platform uses
  254. 10:42tradestation and multi-charts both use
  255. 10:45Easy language metatrader uses mql four
  256. 10:48or five trading view uses its own
  257. 10:51proprietary Pine script ninjatrader uses
  258. 10:55ninjascript which is based on c-sharp
  259. 10:57and quantopian uses python now in this
  260. 11:00course we're going to be focusing mostly
  261. 11:02on easy language which is the coding
  262. 11:04language used by both tradestation and
  263. 11:07multi-charts tradestation and
  264. 11:09multi-charts are exceptional trading
  265. 11:12platforms for systematic trading in
  266. 11:15commodity Futures if you want to see a
  267. 11:17deep dive on the differences between
  268. 11:19tradestation and multi-charts you can
  269. 11:22click a video link here easy language as
  270. 11:25the name suggests is an exceptionally
  271. 11:27easy to learn coding language that's
  272. 11:29written specifically for Traders it's
  273. 11:32easy to write it's easy to understand a
  274. 11:34lot of popular trading books the kind
  275. 11:36we'll talk talk about at the end of this
  276. 11:38course are written in Easy language now
  277. 11:41we're going to be going through a lot of
  278. 11:42easy language strategies in this course
  279. 11:45but remember if you're using another
  280. 11:47platform like metatrader or trading view
  281. 11:50or ninjatrader you can always take that
  282. 11:53strategy code and translate it to your
  283. 11:56platform all of the concepts that we're
  284. 11:58going to be talking about in today's
  285. 11:59course are Universal they are not
  286. 12:02specific to any one coding language data
  287. 12:06the second thing that you are going to
  288. 12:08need to start systematic trading is data
  289. 12:11your trading platform is going to need
  290. 12:13to have access to historical data for
  291. 12:17analysis and testing of your systematic
  292. 12:20trading systems and ultimately your
  293. 12:22trading platform is going to need access
  294. 12:24to live data so you can execute
  295. 12:27systematic trading strategy orders in
  296. 12:30real time now every trading platform is
  297. 12:33different some trading platforms like
  298. 12:36tradestation are your data provider but
  299. 12:39other trading platforms like multi
  300. 12:41charts will require that you plug into
  301. 12:44an external data provider every trading
  302. 12:47platform is different on how they treat
  303. 12:49data and how you can subscribe to data
  304. 12:52but that information is always very
  305. 12:54clear on their website how you can plug
  306. 12:57in data to the trading platform and you
  307. 13:00should be prepared that this will be an
  308. 13:03additional expense for example if you're
  309. 13:05a commodity Trader you might want to pay
  310. 13:07for Chicago Board of Trade data for
  311. 13:10markets like corn and wheat and soybeans
  312. 13:13you'd start with delayed data for your
  313. 13:15strategy analysis and testing that will
  314. 13:18be cheaper something like twenty dollars
  315. 13:20a month and then when you're ready to
  316. 13:22start systematic trading in real time
  317. 13:24you can start paying for live data
  318. 13:27that's going to be more expensive say a
  319. 13:29hundred dollars a month very big picture
  320. 13:31whether you're using delayed data or
  321. 13:34live data these trading platforms make
  322. 13:36it very easy for you to get data into
  323. 13:39their platforms for your analysis or
  324. 13:42live trading the third thing that you
  325. 13:44need to get started algorithmic trading
  326. 13:47is a funded brokerage account when you
  327. 13:50trade commodity Futures The Exchange
  328. 13:52that you are facing needs access to what
  329. 13:55is called margin basically you need to
  330. 13:57set a small amount of money aside like a
  331. 14:01down payment for the right to trade
  332. 14:03commodity Futures contracts here is a
  333. 14:06great cheat sheet that we've put
  334. 14:07together with the margin rates for the
  335. 14:10top 25 U.S commodity Futures markets
  336. 14:13this is included in the full course
  337. 14:16packet that's available at Peak algo.com
  338. 14:19what you'll see is that for a market
  339. 14:21like corn you need to have at minimum
  340. 14:24twenty three hundred dollars in your
  341. 14:26account in margin to trade one contract
  342. 14:29of corn Futures now that's the minimum
  343. 14:32amount that you need in your account
  344. 14:34realistically you are going to want more
  345. 14:37than that how much money do you need to
  346. 14:40trade a systematic trading strategy as a
  347. 14:44good rule of thumb you are generally
  348. 14:46going to want to have 2.5 times the
  349. 14:50minimum required margin for that
  350. 14:52contract what does that mean you take
  351. 14:55the number in that margin column and you
  352. 14:58multiply it by 2.5 now for a market like
  353. 15:01heating oil with a big contract value
  354. 15:04and a relatively high margin of about
  355. 15:07ten thousand dollars that means that
  356. 15:09your trading account should have twenty
  357. 15:12five thousand dollars in it for every
  358. 15:15heating oil systematic trading strategy
  359. 15:17that you turn on now I know this is
  360. 15:20frustrating especially for beginners I
  361. 15:22know this is probably not what you want
  362. 15:25to hear that you need to have a whole
  363. 15:26lot of money set aside for margin the
  364. 15:28good news is there are plenty of
  365. 15:30commodity markets with relatively small
  366. 15:33notional sizes and small margin
  367. 15:36requirements the there are also micro
  368. 15:39and mini contracts so a lot of these
  369. 15:41contracts have smaller versions that
  370. 15:44require about a fifth of the size of
  371. 15:47margins set aside you're just getting
  372. 15:49started in systematic trading or you
  373. 15:51have a smaller brokerage account size it
  374. 15:53is a great option to start with mini and
  375. 15:57micro size contracts in terms of a
  376. 15:59funded brokerage account there are some
  377. 16:02big differences between the different
  378. 16:04trading platforms for example
  379. 16:06tradestation acts as your broker so you
  380. 16:09directly fund an account you send money
  381. 16:12to tradestation or as multi charts can
  382. 16:14plug into a number of different Brokers
  383. 16:17you just give them access to your
  384. 16:20trading account but again big picture
  385. 16:22any trading platform is going to need
  386. 16:25access to money to investment to Capital
  387. 16:28that you've set aside to trade the
  388. 16:31fourth and final thing that you need to
  389. 16:33start systematic trading is a trading
  390. 16:37system or even better a set of different
  391. 16:40Diversified trading systems across a lot
  392. 16:43of different markets we're going to come
  393. 16:45back to this theme time and time again
  394. 16:47in this course that one of your big
  395. 16:50advantages as a systematic Trader is
  396. 16:52your ability to turn on lots of
  397. 16:55different Diversified Futures Trading
  398. 16:58strategies now as part of this course we
  399. 17:00are going to go through the building
  400. 17:03blocks for successful systematic trading
  401. 17:06strategies entries exits filters and of
  402. 17:09course if you want instant access to a
  403. 17:12portfolio of Diversified Futures Trading
  404. 17:15strategies you can head to peakalgo.com
  405. 17:18these are real systematic trading
  406. 17:21strategies that have performed well in
  407. 17:23real time that are in tune with the
  408. 17:25current market they had positive profits
  409. 17:28in the month prior so whether you're a
  410. 17:30beginner looking for coding examples of
  411. 17:33real systematic trading strategies or
  412. 17:36you're a professional commodity Trader
  413. 17:38looking to build out your portfolio
  414. 17:40these strategies at Peak algo.com are a
  415. 17:43great option so those are the four
  416. 17:46things that you need to start systematic
  417. 17:48trading trading platform data that you
  418. 17:51can plug into the platform for analysis
  419. 17:54and real-time trading a brokerage
  420. 17:57account that your trading platform can
  421. 17:59access to trade and you need a trading
  422. 18:02system preferably trading systems and
  423. 18:05that is now what we're going to spend
  424. 18:07most of this course talking about is how
  425. 18:10you can build and test fully coded
  426. 18:13systematic trading strategies that have
  427. 18:15a great chance of working in real time
  428. 18:21thank you
  429. 18:25now before we move on I want to say a
  430. 18:28few quick notes about Peak trading
  431. 18:30research and what puts us in such a
  432. 18:32unique position to build an algo trading
  433. 18:35course like this P trading research is
  434. 18:38an independent quantitative commodity
  435. 18:41research company based in Switzerland we
  436. 18:44focus on non-fundamental quantitative
  437. 18:47price drivers for agriculture energy and
  438. 18:50metals commodity markets our clients are
  439. 18:53hedge funds family offices private
  440. 18:56Traders and many of the world's largest
  441. 18:58commercial trading houses and because we
  442. 19:01provide a unique and quantitative view
  443. 19:04on commodity markets we are frequently
  444. 19:06quoted in the Wall Street Journal the
  445. 19:08financial times market watch warning
  446. 19:11star Bloomberg and other Publications
  447. 19:14and as part of our research for our
  448. 19:16clients we are building and testing a
  449. 19:19lot of quantitative trading systems many
  450. 19:22of those systems we make available to
  451. 19:25clients through our site Peak algo.com
  452. 19:28so this course is both for our commodity
  453. 19:31research clients who are interested in
  454. 19:33getting up to speed with building and
  455. 19:35testing systematic trading strategies as
  456. 19:38well as our algo trading clients who are
  457. 19:41interested in building a portfolio of
  458. 19:43systematic trading strategies so if you
  459. 19:46are looking for an algorithmic trading
  460. 19:49course built by an industry-leading
  461. 19:51quantitative commodity research company
  462. 19:54hosted by a professional commodity
  463. 19:56Trader with more than two decades of
  464. 19:59experience at two of the US's largest
  465. 20:02private commodity trading houses then
  466. 20:04you have come to the right place now one
  467. 20:07of the advantages of algorithmic trading
  468. 20:11of rule-based trading is that you can
  469. 20:13confirm for yourself all of the concepts
  470. 20:17that we will cover in this course you
  471. 20:19should not trust any Trader any educator
  472. 20:22any research company without confirming
  473. 20:25the results for yourself and that is a
  474. 20:28theme that will be coming back to again
  475. 20:30and again in this course is that you can
  476. 20:32build strategies yourself test
  477. 20:34strategies yourself and set your
  478. 20:37portfolio of real systematic trading
  479. 20:39strategies up to have the best chance of
  480. 20:42generating profits for you in real time
  481. 20:45we've now finished the first section of
  482. 20:47this course which is algo Basics and
  483. 20:50we're going to move on to the second
  484. 20:52section of this course which is system
  485. 20:54building blocks this is the foundation
  486. 20:57the very beginning of the systematic
  487. 21:00strategy development process this is
  488. 21:03what successful systematic trading
  489. 21:05strategy development looks like we are
  490. 21:08going to spend the next five sessions at
  491. 21:11the bottom of this mountain at the
  492. 21:13foundation of this strategy development
  493. 21:16pyramid in this section on system
  494. 21:19building blocks we'll talk about systems
  495. 21:22building 101 go through some entries
  496. 21:24exits some system examples and also
  497. 21:28entry filters and after that we'll move
  498. 21:30on to the next section on optimization
  499. 21:33incubation and portfolio construction
  500. 21:36now in the next few sessions we'll be
  501. 21:39looking at a lot of strategy logic that
  502. 21:41is written in the easy language coding
  503. 21:44language all of this strategy code the
  504. 21:47entries the exits the strategy system
  505. 21:50examples that we'll go through our Opus
  506. 21:53strategy that you can use to test
  507. 21:55thousands of different entry and exit
  508. 21:57combinations and a version of our
  509. 22:00filters code built specifically for this
  510. 22:03course is available in the course packet
  511. 22:06that you can find at peakalgo.com so
  512. 22:09don't feel that you need to spend your
  513. 22:11time writing this out typing it out
  514. 22:13taking screenshots all of the code that
  515. 22:15we'll go through is available as text
  516. 22:17files and also if you're a tradestation
  517. 22:20or multi-charts user as CSV files again
  518. 22:23that is all available in the course
  519. 22:26packet at Peak algo.com let's now move
  520. 22:29on to the next section system building
  521. 22:32blocks
  522. 22:35[Music]
  523. 22:38foreign
  524. 22:39big picture let's review what we've
  525. 22:42talked about in this course so far we've
  526. 22:44talked about algo trading 101 what is
  527. 22:47algorithmic trading we talked about the
  528. 22:49massive advantages of algorithmic
  529. 22:52trading versus discretionary trading and
  530. 22:54we've reviewed the four things that you
  531. 22:57need to get started with algorithmic
  532. 22:59trading so now let's move on to the fun
  533. 23:01stuff let's talk about building and
  534. 23:04testing real systematic trading
  535. 23:06strategies as well as the tools and
  536. 23:09Concepts that you need to understand to
  537. 23:12ensure that your systematic trading
  538. 23:14strategies have a great chance of making
  539. 23:17money and generating profits in real
  540. 23:19time now algorithmic trading is
  541. 23:22rule-based trading you are telling your
  542. 23:24trading platform that you want to trade
  543. 23:27a certain Market based on a predefined
  544. 23:29set of rules and when you write down
  545. 23:32those rules in a certain coding language
  546. 23:34you are writing a script you are writing
  547. 23:38a simple set of rules that your trading
  548. 23:40platform can access and add to a chart
  549. 23:43and generate profit statistics so you
  550. 23:46can gauge if you want to trade that
  551. 23:48strategy or not and all of the automated
  552. 23:50trading platforms that we talked about
  553. 23:52in our section on the four things you
  554. 23:54need to start algorithmic trading all
  555. 23:57those trading platforms are chart-based
  556. 24:00trading platforms meaning you're writing
  557. 24:02your script you're writing down The
  558. 24:04rules that you want to trade you're
  559. 24:06adding that script to a chart and then
  560. 24:08you're deciding based on how the system
  561. 24:11trades The Profit statistics if you want
  562. 24:14to automate that trading system that's
  563. 24:16the process we're going to be talking
  564. 24:18about again and again in this course
  565. 24:20writing a script adding it to a chart
  566. 24:22looking at how the system trades and
  567. 24:25some profit statistics and deciding if
  568. 24:27it's a good trading system now all
  569. 24:30trading strategies are written as
  570. 24:32conditional if then statements it
  571. 24:35doesn't matter if you're coding in the
  572. 24:37easy language coding language or pine
  573. 24:40script or python or C sharp every
  574. 24:43strategy that you write is going to be a
  575. 24:46complete conditional statement these
  576. 24:48conditional statements are almost always
  577. 24:50written as if this condition exists then
  578. 24:54do this and that this is mostly trade
  579. 24:57the market some good examples of simple
  580. 24:59conditional statements are if momentum
  581. 25:02is positive then I the market so buy a
  582. 25:06Futures Contract if a moving average is
  583. 25:09crossing below another moving average
  584. 25:12then sell the market if it's January
  585. 25:1515th then buy the market and get out
  586. 25:19after 20 days these are simple
  587. 25:21conditional if then trading statements
  588. 25:24now one of the big advantages of the
  589. 25:26easy language coding language that we'll
  590. 25:28be using a lot in this course is that as
  591. 25:32the name suggests it's a very easy
  592. 25:34language to understand when you are
  593. 25:36writing down your trading rules that the
  594. 25:39system and will follow those conditional
  595. 25:41if then statements easy language really
  596. 25:44writes and reads like a sentence so
  597. 25:47let's look at an example of one of these
  598. 25:50if then statements let's look at a very
  599. 25:52simple two-line complete systematic
  600. 25:56trading strategy let's jump into the
  601. 25:58trade station trading platform now this
  602. 26:01is what tradestation looks like right
  603. 26:04out of the box so if you have never used
  604. 26:06tradestation or you've never used any
  605. 26:09other automated trading platform this is
  606. 26:12generally what a automated trading
  607. 26:14platform will look like to start we are
  608. 26:16going to go up and open up our easy
  609. 26:19language editor think of this as the
  610. 26:22place where you are going to write your
  611. 26:24scripts you are going to write down the
  612. 26:27rules and the strategies that you want
  613. 26:30to trade I'm going to open up a new
  614. 26:31strategy I am simply going to call this
  615. 26:34our first strategy two lines of code
  616. 26:39simple enough I'm going to delete the
  617. 26:42starter code that it gives us and for
  618. 26:44this strategy we are going to write this
  619. 26:46like a sentence so we're going to build
  620. 26:48a momentum strategy that says if the
  621. 26:51close is the highest close of the past
  622. 26:5410 days then by the next bar at Market
  623. 26:58so basically get in on the next possible
  624. 27:01opportunity the next time the Market
  625. 27:03opens if this is a daily bar and then if
  626. 27:06time has passed so if 10 bars have
  627. 27:10passed so if we're using daily bars that
  628. 27:12will be 10 days if 10 bars have passed
  629. 27:15since I bought the market then sell next
  630. 27:18bar at Market this is now a complete and
  631. 27:23I'm going to verify it so I know it's a
  632. 27:25complete strategy this is a complete
  633. 27:27fully coded systematic trading strategy
  634. 27:30it has those nice conditional statements
  635. 27:33if the market is going higher so if the
  636. 27:35market closes the highest close then buy
  637. 27:38that upward momentum them and if 10 bars
  638. 27:41have gone by or 10 days have gone by get
  639. 27:44out of that long position now that we
  640. 27:46have our strategy written let's add our
  641. 27:48strategy to a chart so we are going to
  642. 27:52bring up a chart and let's make this a
  643. 27:56heating oil chart so we are going to be
  644. 27:58looking at the heating oil Futures
  645. 28:01Market I'm going to go to my time frame
  646. 28:03customize there's the ticker for heating
  647. 28:05oil at ho is the heating oil continuous
  648. 28:09contract and let's make this
  649. 28:11240 minute bars so that is a four hour
  650. 28:15bar Futures let's go back to 2010 and
  651. 28:18voila there is the chart for heating oil
  652. 28:22240 minute bars I can then add the
  653. 28:25simple strategy script that we've
  654. 28:27written that two lines of code simple
  655. 28:30first strategy two line of code strategy
  656. 28:32and there we go tradestation can see it
  657. 28:35tradestation says this is a good
  658. 28:36strategy let's pop it in the chart and
  659. 28:38we can see how this strategy trades on a
  660. 28:43chart it's a momentum strategy again we
  661. 28:45are buying higher closes so if the close
  662. 28:48is the highest close of the past 10 bars
  663. 28:51the past 10 240 minute bars the system
  664. 28:54will buy buying upward momentum getting
  665. 28:57out after 10 bars buying upward momentum
  666. 28:59getting out after 10 bars it's generally
  667. 29:01a pretty good momentum strategy now one
  668. 29:04of the advantages of this being a
  669. 29:06rule-based system a systematic trading
  670. 29:09strategy is that we can look at a
  671. 29:11strategy performance report we can see
  672. 29:14that simple approach of buying upward
  673. 29:17momentum buying higher closes in the
  674. 29:20heating oil Futures Market it's done
  675. 29:22okay the strategy has made about a
  676. 29:24hundred and twenty thousand dollars over
  677. 29:26the past 12 years if we look at a equity
  678. 29:30curve it's okay it's done well recently
  679. 29:32not so well in the Years prior but as a
  680. 29:35starting point it's good to see that
  681. 29:38this simple breakout system two lines of
  682. 29:40code can make money in heating oil
  683. 29:43Futures so that's systematic trading
  684. 29:45writing down simple rule-based
  685. 29:48conditional statements adding that
  686. 29:50strategy to a chart so we can see how
  687. 29:52the system trades and we can look at
  688. 29:54some basic profit statistics this is the
  689. 29:57core of systematic trading and it's what
  690. 29:59we're going to be spending a lot of this
  691. 30:01course doing building strategies testing
  692. 30:04strategies see how they trade and gauge
  693. 30:07if it's a strategy that we want to turn
  694. 30:09on and automate to generate profits in
  695. 30:12real time now one quick note before we
  696. 30:14move on we wrote that simple trading
  697. 30:17strategy in the easy language coding
  698. 30:19language but here's that same strategy
  699. 30:22written in hindscript and that same
  700. 30:25strategy written in ninjascript C sharp
  701. 30:28what you'll notice is that once you
  702. 30:30understand what that easy language code
  703. 30:33is accomplishing buying a higher high
  704. 30:35getting out after 10 bars differences
  705. 30:38between easy language Pine script and
  706. 30:41ninja script and python it's like the
  707. 30:43differences between Italian and Spanish
  708. 30:46and Portuguese and French these are the
  709. 30:48romance languages of systematic trading
  710. 30:51so again in this course today focus more
  711. 30:54on the trade logic and what we're doing
  712. 30:57with these strategies don't get too hung
  713. 30:59up on the fact it's written in Easy
  714. 31:01language all of the concepts that we're
  715. 31:03talking about today are Universal to
  716. 31:06systematic trading regardless of the
  717. 31:09coding language that you use now we're
  718. 31:11going to be doing a lot of strategy
  719. 31:13building today but if you want to watch
  720. 31:16another video on building a simple
  721. 31:19systematic trading strategy you can
  722. 31:21click here to watch our video titled
  723. 31:24build your first strategy it's another
  724. 31:26good overview of some of the simple
  725. 31:28building blocks that we'll be going
  726. 31:30through today entries exits variables
  727. 31:33filters and that's what we'll be talking
  728. 31:35about in our next three sessions is
  729. 31:38strategy entries strategy exits filters
  730. 31:41really those fundamental building blocks
  731. 31:43that you can use to create exceptional
  732. 31:46systematic trading strategies so let's
  733. 31:48move on to the next session and talk
  734. 31:50about the most fundamental building
  735. 31:52block of a systematic trading strategy
  736. 31:55great strategy entries
  737. 31:59foreign
  738. 32:00[Music]
  739. 32:05strategy has two important building
  740. 32:07blocks and that is entries and exits a
  741. 32:10strategy entry gets you into a long or
  742. 32:13short position in a commodity future or
  743. 32:16stock or Bond and an exit gets you out
  744. 32:19of that position so let's look at the 10
  745. 32:21greatest of all time entries that you
  746. 32:24can be using to build profitable
  747. 32:26systematic trading strategies and of
  748. 32:28course you don't need to write any of
  749. 32:30these entries down they're all available
  750. 32:32in the peak I'll go trading package at
  751. 32:35peakalgo.com now what makes these the
  752. 32:38greatest trading entries you are going
  753. 32:40to see these trading entries time and
  754. 32:42time again in the strategies that we
  755. 32:45build at peakalgo.com you'll see them in
  756. 32:47systematic strategy books you'll see
  757. 32:49them in YouTube videos online and most
  758. 32:52importantly you'll find yourself falling
  759. 32:54back on these strategy entries as a
  760. 32:56great Foundation upon which you can
  761. 32:58build more complicated systematic
  762. 33:01strategies bottom line they work you're
  763. 33:04going to see them a lot and most of the
  764. 33:06strategies you build and trade will rely
  765. 33:09on these basic strategy entries now as
  766. 33:11always we'll be going through these
  767. 33:13strategies written in the easy language
  768. 33:15coding language but focus more on the
  769. 33:18strategy logic what the strategy is
  770. 33:20trying to do and less on the specific
  771. 33:23code so if you want to recreate what
  772. 33:25these strategies are doing in python or
  773. 33:28r or C plus plus or Microsoft Excel you
  774. 33:32can do that these strategy concept
  775. 33:34entries are Universal for our first
  776. 33:37strategy entry let's look at a simple
  777. 33:40price pattern what this strategy does is
  778. 33:43it says if the close of the last bar was
  779. 33:46greater than the open of the last bar
  780. 33:48and the close two bars ago was greater
  781. 33:51than the open two bars ago and the close
  782. 33:53three bars ago was greater than the open
  783. 33:56than buy next bar at Market so buy
  784. 33:58upward momentum and vice versa if you
  785. 34:01have lower closes for three bar bars in
  786. 34:05a row then sell short the next bar at
  787. 34:08market now one of the advantages of
  788. 34:10course of coding this up and adding it
  789. 34:13to a platform like tradestation is that
  790. 34:15we can see how this strategy works on a
  791. 34:18chart so here we have three lower bars
  792. 34:21the strategy sells short we have three
  793. 34:23Rising bars the strategy goes long this
  794. 34:27strategy on crude oil 240 minute bars
  795. 34:30has been working pretty well recently
  796. 34:33the strategy successfully bought upward
  797. 34:35momentum sold upward momentum bought
  798. 34:37upward momentum and sold downward
  799. 34:40momentum now for our next strategy entry
  800. 34:43let's look at a simple breakout this
  801. 34:45works well for markets that Trend so
  802. 34:48what this strategy does is it says if
  803. 34:51the market close of the last bar is the
  804. 34:54highest close of the past 10 bars then
  805. 34:57buy the next bar at market and if the
  806. 35:00market closed is the lowest close of the
  807. 35:03past 10 bars then and sell short at
  808. 35:06markets so again it's a different way to
  809. 35:08buy upward momentum and sell downward
  810. 35:10momentum and we can see what this
  811. 35:13strategy looks like on a chart let's add
  812. 35:16this to a gold 240 minute bar chart you
  813. 35:20can see that when we're at the highest
  814. 35:23close of the past 10 bars the system
  815. 35:26goes long when we're at the lowest close
  816. 35:28of the past 10 bars the system sells
  817. 35:31short gold Futures system chopped around
  818. 35:33a little bit here bought and sold and
  819. 35:36bought and then here it went short again
  820. 35:38at the lowest bar of the last 10 bars
  821. 35:40and successfully made a nice short trade
  822. 35:43now this is a good opportunity for us to
  823. 35:47add our very first input so we can add
  824. 35:51an input called length x and replace our
  825. 35:55static value of 10 bars with our new
  826. 35:58input and this allows us to optimize
  827. 36:01this input value in trade state trade
  828. 36:05station will tell us instead of 10 the
  829. 36:07best value to use between 5 and 15 is
  830. 36:11going to be a value of 5. so if we
  831. 36:14optimize for net profit we can see that
  832. 36:17actually a value of 5 is better than 10
  833. 36:20for buying higher highs and selling
  834. 36:23lower lows we can see the system is
  835. 36:25doing pretty well here in terms of
  836. 36:28buying higher highs selling lower lows
  837. 36:30it's catching some nice moves on gold
  838. 36:33240 minute bars now let's look at a
  839. 36:36simple mean reversion entry this is for
  840. 36:39markets that mean revert so unlike our
  841. 36:43breakout strategy that buys higher
  842. 36:46closes in this case we are going to be
  843. 36:48selling short the highest close of the
  844. 36:51last X bars so this was our breakout
  845. 36:54strategy instead of buying a higher
  846. 36:57close we are going to sell short and
  847. 36:59instead of selling short on a lower
  848. 37:02close we're going to be buying so again
  849. 37:05selling short a higher close buying a
  850. 37:08lower close and if we add our strategy
  851. 37:11our mean reversion strategy entry to a
  852. 37:14mean reverting market like the Coco
  853. 37:17Market this is Coco daily bars we can
  854. 37:19see that this simple mean reversion
  855. 37:21strategy that buys lower closes sells
  856. 37:24higher closes buys lower closes sells
  857. 37:27higher closes has been working
  858. 37:29exceptionally well in a mean reverting
  859. 37:32sideways trading Market environment for
  860. 37:35our next strategy entry let's look at
  861. 37:37using a market indicator like trading
  862. 37:40volume or RSI momentum or macd momentum
  863. 37:44or adx momentum as a requirement before
  864. 37:49buying lower closes or selling short
  865. 37:51higher closes basically this trading
  866. 37:54system is looking for a low volume or a
  867. 37:58low momentum reversal as a signal to
  868. 38:01trade we can see what this looks like in
  869. 38:04feeder cattle which is a smaller Market
  870. 38:07in which volume is an important
  871. 38:09indicator for the next direction of the
  872. 38:12market this system does a nice job of
  873. 38:15selling short higher closes buying lower
  874. 38:18closes when volume is also dropping at
  875. 38:21the same time we can see that the system
  876. 38:23has performed fairly well over the past
  877. 38:26year we see a nice upward sloping
  878. 38:29cumulative profit line an upward sloping
  879. 38:32Equity curve for our next strategy entry
  880. 38:35let's look at dueling momentum and this
  881. 38:38will be the first time that we
  882. 38:40incorporate a second strategy input
  883. 38:43called length two so in this case we are
  884. 38:46going to be going with short-term
  885. 38:48momentum in this case 15 bar momentum
  886. 38:51against long-term momentum for example
  887. 38:5450 bar momentum so how does this
  888. 38:57strategy work if the most recent close
  889. 38:59is above the close 15 bars ago but still
  890. 39:04below the close 50 bars ago the strategy
  891. 39:08will buy the next bar at market and vice
  892. 39:11versa of the most recent close is below
  893. 39:14the close 15 bars ago but above the
  894. 39:17close 50 bars ago the strategy will sell
  895. 39:20short next bar at Market if we add our
  896. 39:23dueling momentum strategy to an orange
  897. 39:26juice 230 minute bar chart we can see
  898. 39:30how this dueling momentum strategy works
  899. 39:32this strategy is buying when prices are
  900. 39:36low but near-term momentums turning
  901. 39:38higher and it's selling short when
  902. 39:41prices are high but near-term momentum
  903. 39:43is turning lower and if we look at a
  904. 39:46strategy performance report we can see a
  905. 39:49nice upward sloping Equity curve over
  906. 39:52the past 10 years this dueling momentum
  907. 39:55approach in orange juice Futures has
  908. 39:58performed pretty well for our next
  909. 40:00strategy entry let's look at using a
  910. 40:04date trade this is the foundation for
  911. 40:07trading price seasonals what this
  912. 40:09strategy does is the strategy will buy
  913. 40:13if the date crosses over September 1st
  914. 40:172022 it will do the same thing for 2021
  915. 40:21and the same thing for
  916. 40:232020. this is good for a market like
  917. 40:27corn which is seasonally bullish corn
  918. 40:30Futures tend to rise in September and
  919. 40:33October and November during U.S Harvest
  920. 40:36months we can add a simple bars sense
  921. 40:39entry exit to this strategy to get a
  922. 40:42sense for what it looks like on a chart
  923. 40:45so what this system is doing is again
  924. 40:47buying corn Futures on September 1st
  925. 40:512020 on September 1st 2021 and again on
  926. 40:55September 1st of this year 2022 and
  927. 40:59exiting that position 90 days later now
  928. 41:03you might ask why use the date crosses
  929. 41:06over code instead of just if the date
  930. 41:09equals September 1st the reason for that
  931. 41:12is if your September 1st falls on a
  932. 41:16weekend or a holiday you still want
  933. 41:18tradestation to pick up a trading signal
  934. 41:21for the next Open Session by coding if
  935. 41:24date crosses over September 1st you're
  936. 41:28allowing tradestation to do that now if
  937. 41:30you want access to an Excel spreadsheet
  938. 41:33with a version of this seasonal code
  939. 41:35that allows you to optimize for getting
  940. 41:38into a trade before and after a specific
  941. 41:41date as well as being able to optimize
  942. 41:43how long to stay in that trade just
  943. 41:46shoot me an email Insight at
  944. 41:48peaktradingresearch.com and I will send
  945. 41:51that over to you for our next strategy
  946. 41:53entry let's use the day of the week to
  947. 41:56trade for example let's always go long
  948. 41:59on Wednesdays what this strategy does is
  949. 42:02it says if the day of the week is day
  950. 42:05number two that's Tuesday then buy the
  951. 42:08next bar at Market that's Wednesday and
  952. 42:11if the date of the week is number three
  953. 42:13that's Wednesday set the exit on close
  954. 42:16so another way to say that is get in on
  955. 42:18the open on Wednesday get out at the
  956. 42:21close on Wednesday and if we add this
  957. 42:24strategy to a soybean daily bar chart we
  958. 42:28can see how this strategy works the
  959. 42:31strategy is buying the open on
  960. 42:33Wednesdays it's getting out on the close
  961. 42:36on Wednesdays now this strategy worked
  962. 42:39really well in 2021 and early 2022 when
  963. 42:44energy markets were rallying you had
  964. 42:46generally bullish statistics from the
  965. 42:49Department of energy released on
  966. 42:51Wednesdays so Wednesday was generally a
  967. 42:54good day of the week to be long soybean
  968. 42:56futures for our next strategy entry
  969. 42:59we're going to be incorporating an
  970. 43:01external data set to trade now this
  971. 43:04external data set can be anything that
  972. 43:07has a date and a value for example it
  973. 43:10could be the rainfall in Iowa for the
  974. 43:13past 10 years it could be the value of
  975. 43:16cash French wheat for the past 10 years
  976. 43:19or as one of my favorite indicators we
  977. 43:22can use the commitment of Traders the
  978. 43:25cot report net hedge fund position for a
  979. 43:29specific Market this could help us
  980. 43:31determine if hedge funds the speculators
  981. 43:34in commodity markets are extended short
  982. 43:37or they're extended long in a particular
  983. 43:40market so this is what our strategy
  984. 43:43entry code that incorporates an external
  985. 43:46data set looks like for example we will
  986. 43:49look at a situation in which the hedge
  987. 43:52fund net long position the hedge fund
  988. 43:55non-commercial net position is above a
  989. 43:58value of 20 000 contracts short in that
  990. 44:01case we are going to look to sell short
  991. 44:04the next bar at the lowest low of the
  992. 44:08past two bars stop we're going to look
  993. 44:10to sell downward momentum if we're above
  994. 44:12that threshold now tradestation has this
  995. 44:16non-commercial net position as a code
  996. 44:19that we can simply enter like this and
  997. 44:22to make this a realistic complete
  998. 44:25strategy we'll simply add a line of code
  999. 44:27that says we will get out if bar sense
  1000. 44:31entry is greater than 10 bars we can now
  1001. 44:34add this external data set strategy to a
  1002. 44:38wheat daily bar chart and trade station
  1003. 44:41and we can see what the strategy is
  1004. 44:43doing it is going short on Lower
  1005. 44:46momentum only if the non-commercial
  1006. 44:50position is above a certain threshold so
  1007. 44:54if hedge funds are extended long in
  1008. 44:56wheat then and only then will this
  1009. 44:59system start trying to sell front month
  1010. 45:02wheat futures for a profit Now Inc
  1011. 45:04incorporating an external data set to
  1012. 45:07trade especially if that data set is
  1013. 45:10based on a fundamental value something
  1014. 45:13like the cash value of a commodity or a
  1015. 45:16supply and demand balance sheet value or
  1016. 45:18a weather value that is increasingly
  1017. 45:21being called Quantum mentals trading
  1018. 45:24that is using a fundamental value as a
  1019. 45:27threshold or a prerequisite for
  1020. 45:30establishing a quantitative trading
  1021. 45:32position if you work for a commodity
  1022. 45:34hedge fund or a big commodity trading
  1023. 45:37house you need to be familiar with this
  1024. 45:39style of quantimentals trading our next
  1025. 45:42strategy entry is a moving average
  1026. 45:45crossover entry and it's the first time
  1027. 45:48that we'll be using variables to
  1028. 45:51establish a trading position a strategy
  1029. 45:53variable is a dynamic value or an
  1030. 45:56equation that we can easily reference
  1031. 45:59later in our strategy and keep the
  1032. 46:02strategy more simple in this case we'll
  1033. 46:04be defining our moving average short
  1034. 46:07variable as the average close of a short
  1035. 46:11length and our moving average long
  1036. 46:14variable as the average close of a
  1037. 46:17longer length if the shorter moving
  1038. 46:19average crosses over the longer moving
  1039. 46:22average than buy next bar at market and
  1040. 46:25vice versa if the shorter moving average
  1041. 46:28crosses under the longer moving average
  1042. 46:31than sell short next bar at market and
  1043. 46:34now we can look at what this strategy
  1044. 46:36looks like on a heating oil daily bar
  1045. 46:40chart we can also add those moving
  1046. 46:42average lines to our chart to really see
  1047. 46:45when they cross over you can see what
  1048. 46:47the strategy is doing when the
  1049. 46:49short-term moving average crosses below
  1050. 46:51the long term the strategy gets short
  1051. 46:53and when the short term crosses up
  1052. 46:55through the long term the strategy gets
  1053. 46:57long and if we look at a performance
  1054. 47:00report that's not too bad for a simple
  1055. 47:03moving average cross silver strategy
  1056. 47:05that is always in the market this moving
  1057. 47:08average crossover approach has done
  1058. 47:11pretty well given the big Market swings
  1059. 47:13that we've seen in heating oil Futures
  1060. 47:15over the past two years so we've walked
  1061. 47:18through nine exceptional systematic
  1062. 47:21strategy entries it's time to look at
  1063. 47:23the goat the greatest of all time
  1064. 47:26strategy entry this is a simple breakout
  1065. 47:29entry that works well across a lot of
  1066. 47:32different markets especially breakout
  1067. 47:34commodity markets like crude oil heating
  1068. 47:37oil gasoline soybeans soybean meal lean
  1069. 47:41Hogs gold and silver so let's look at
  1070. 47:44our goat breakout strategy code there it
  1071. 47:47is this is the greatest of all time
  1072. 47:50strategy entries it's a simple stop
  1073. 47:53breakout it is buying the next bar at
  1074. 47:56the highest high of the past 10 bars on
  1075. 47:59a stop and it is selling short the next
  1076. 48:01bar at the lowest lows of the past 10
  1077. 48:04bars on a stop now you'll often hear
  1078. 48:07Traders talk about stopping out of a
  1079. 48:10position this strategy stops you into a
  1080. 48:13position meaning if the price prints at
  1081. 48:16or above the highest high of the past 10
  1082. 48:19bars this strategy will enter
  1083. 48:21immediately it will not wait to execute
  1084. 48:24at the next bar at Market it will
  1085. 48:26execute immediately and if we add our
  1086. 48:29goat breakout strategy to a gasoline 240
  1087. 48:33minute bar chart we can get a real sense
  1088. 48:35for how this strategy trades if the
  1089. 48:39market is breaking lower and sees the
  1090. 48:42lowest level of the past 10 bars it
  1091. 48:44stops into a short position it gets in
  1092. 48:46immediately and if the market is turning
  1093. 48:49higher and prints the highest level of
  1094. 48:51the past 10 bars the strategy will stop
  1095. 48:54into a long position immediately we can
  1096. 48:57see that this breakout strategy has done
  1097. 48:59a very nice job of catching some of the
  1098. 49:02big swings that we've seen in gas Celine
  1099. 49:05Futures recently and if we look at a
  1100. 49:07longer term performance chart look at
  1101. 49:10that that is a nice upward sloping
  1102. 49:13Equity curve this approach of buying
  1103. 49:15higher highs and selling lower lows with
  1104. 49:18stops has worked exceptionally well over
  1105. 49:21the past decade in gasoline Futures you
  1106. 49:24now have 10 great strategy entries that
  1107. 49:27you can use over and over again to
  1108. 49:29develop some really exceptional
  1109. 49:31systematic trading strategies even more
  1110. 49:34complicated systematic trading
  1111. 49:36strategies with dozens of lines of code
  1112. 49:39and different filters and variables and
  1113. 49:41exits often rely on these very simple
  1114. 49:44strategy entries as the foundation so
  1115. 49:47now let's move on to strategy exits
  1116. 49:51foreign
  1117. 49:53[Music]
  1118. 49:58we talked about the 10 greatest strategy
  1119. 50:01entries and now it's time to cover the
  1120. 50:0410 greatest strategy exits every trading
  1121. 50:07strategy has those two important
  1122. 50:09building blocks entries and exits exits
  1123. 50:12are often overlooked but they are just
  1124. 50:14as important as strategy entries great
  1125. 50:17exits can help you manage risk they can
  1126. 50:19help you lock in profits and overall
  1127. 50:21they can make you a better more
  1128. 50:23confident Trader so the 10 greatest
  1129. 50:26strategy exits let's look at the list as
  1130. 50:29always we'll be looking at some easy
  1131. 50:31language strategy code but Focus Less on
  1132. 50:34the code itself and more on the strategy
  1133. 50:37logic that way if you're using another
  1134. 50:39coding language like python or C plus
  1135. 50:42plus or r or you're doing your work in
  1136. 50:45Microsoft Excel you can still use these
  1137. 50:48exits so let's get started let's look at
  1138. 50:50the greatest of all time strategy exits
  1139. 50:53starting with exit number 10 for the
  1140. 50:56first exit that will be looking at this
  1141. 50:58is a system where your entry is the same
  1142. 51:02as your exit this is a complete trading
  1143. 51:05system that is always long or short the
  1144. 51:08way this strategy works is if the market
  1145. 51:11closed is the highest close of the last
  1146. 51:13six bars then the system will buy the
  1147. 51:15next bar at market and vice versa if the
  1148. 51:18close is the lowest close of the past
  1149. 51:21six bars the system will sell short next
  1150. 51:24part market and again it's a complete
  1151. 51:26system the system is always long or
  1152. 51:28short it's always in the market and we
  1153. 51:30can see what this looks like if we add
  1154. 51:33this strategy to a heating oil 240
  1155. 51:36minute bar chart the system does a nice
  1156. 51:38job of selling short on downward
  1157. 51:41momentum and buying upward momentum
  1158. 51:44selling short on downward momentum if
  1159. 51:47you look at a strategy performance
  1160. 51:48report the system has done fairly well
  1161. 51:51over the past year for just two lines of
  1162. 51:53code always in the market this run up
  1163. 51:56here is Russia as invasion of Ukraine
  1164. 51:58when we saw a lot of volatility and a
  1165. 52:01lot of big breakout moves in heating oil
  1166. 52:03futures for our next trading exit we'll
  1167. 52:06just look at a simple stop loss this is
  1168. 52:09the simplest of all exits and it's a
  1169. 52:12good way to manage risk what this exit
  1170. 52:16does is it says if the system is at any
  1171. 52:19point losing five thousand dollars per
  1172. 52:22contract just exit the position exit the
  1173. 52:24position immediately and if we add this
  1174. 52:28stop loss exit to our goat stop breakout
  1175. 52:31entry that we worked on in our video on
  1176. 52:34strategy entries we can see what this
  1177. 52:37looks like on a chart again the strategy
  1178. 52:39is going short on Lower momentum it's
  1179. 52:42buying upward momentum but we can see
  1180. 52:44that once in a while it's hitting a stop
  1181. 52:46loss and this brings up an important
  1182. 52:48question do you need a stop loss does
  1183. 52:52your system need to have a stop loss not
  1184. 52:55necessarily you can build systems that
  1185. 52:57are always long or short that are always
  1186. 52:59in the market that are always waiting
  1187. 53:01for that next trading signal in the
  1188. 53:03opposite direction to get out of a trade
  1189. 53:05a stop loss will generally help you
  1190. 53:07sleep better at night it's just a nice
  1191. 53:09way to know that if things really go
  1192. 53:11wrong you're gonna get out of a position
  1193. 53:13so bottom line even if adding a stop
  1194. 53:16loss maybe doesn't improve the backward
  1195. 53:18looking Equity curve of your trading
  1196. 53:21system you should still consider adding
  1197. 53:23a stop loss it's a good simple risk
  1198. 53:25management and it makes your trading
  1199. 53:27system more realistic more tradable for
  1200. 53:30our next trading exit we have a simple
  1201. 53:33profit Target like a stop loss this is a
  1202. 53:37simple line of code that will take
  1203. 53:39profit on a position if the total gain
  1204. 53:42is more than ten thousand dollars and if
  1205. 53:46we add our profit Target to our goat
  1206. 53:49entry and add it to a heating oil 240
  1207. 53:53minute bar chart we can see how a profit
  1208. 53:55Target works the system will sell short
  1209. 53:57it's a profit Target go short again hit
  1210. 54:00another profit Target and so on now you
  1211. 54:02might ask why add a profit Target to a
  1212. 54:06trading system why not just let your
  1213. 54:08winners always run there are two reasons
  1214. 54:11for this the first reason is if you look
  1215. 54:14at an equity curve going back through
  1216. 54:16time you'll often find one or two or
  1217. 54:19three really big gains that make up most
  1218. 54:23of the profits over the course of the
  1219. 54:25past 10 years meaning the trading system
  1220. 54:27happened to catch a few big volatile
  1221. 54:30moves like the financial crisis or the
  1222. 54:33covid washout or Russia invading Ukraine
  1223. 54:36and you don't necessarily want to rely
  1224. 54:38on a system that plays for those types
  1225. 54:40of events in the future that you may not
  1226. 54:42catch and adding a profit Target limits
  1227. 54:46the impact of those one-off macro events
  1228. 54:48the second reason is adding a profit
  1229. 54:51Target just makes your system more
  1230. 54:53realistic if your system usually makes
  1231. 54:55gains of a thousand or two thousand or
  1232. 54:58three thousand dollars per contract and
  1233. 55:00all of a sudden you find yourself
  1234. 55:02sitting on a gain of five or six or
  1235. 55:05seven thousand dollars per contract
  1236. 55:06realistically you will probably take
  1237. 55:09profit on that position we all want to
  1238. 55:12say that we're systematic Traders and
  1239. 55:14that will always let our systems run but
  1240. 55:16realistically if you're sitting on a big
  1241. 55:19gain you'll probably take those chips
  1242. 55:21off the table why not code that in why
  1243. 55:23not code in a profit Target our next
  1244. 55:26trading exit is a simple profit Target
  1245. 55:29that executes on the next bar at Market
  1246. 55:33there's nothing really groundbreaking
  1247. 55:35here the only difference is that if your
  1248. 55:38max position profit is greater than your
  1249. 55:41profit Target four thousand dollars per
  1250. 55:43contract five thousand dollars per
  1251. 55:44contract six thousand dollars per
  1252. 55:46contract the system will then exit at
  1253. 55:48the next bar at Market either sell or
  1254. 55:51buy to cover on the next Market Bar an
  1255. 55:54advantage of this approach is that you
  1256. 55:56can take it advantage of the liquidity
  1257. 55:58on the next Market open if you're a
  1258. 56:01larger Trader or if you just want to
  1259. 56:03execute trades once a day if you've
  1260. 56:05built your system to always execute next
  1261. 56:08bar at Market you can use an entry that
  1262. 56:10enters next bar Market with this exit
  1263. 56:12that always executes next bar and Market
  1264. 56:14our next exit is a simple trailing take
  1265. 56:18profit exit this is a great exit what
  1266. 56:22this code is doing is it's saying if the
  1267. 56:24max position profits so the most money
  1268. 56:28that we've ever made on a position minus
  1269. 56:31the open position profit so the current
  1270. 56:33profit that we have at this minute is
  1271. 56:36greater than two thousand so if you've
  1272. 56:39made ten thousand dollars at some point
  1273. 56:40and all of a sudden you're down to only
  1274. 56:42seventy five hundred dollars that's
  1275. 56:44greater than two thousand this system
  1276. 56:46will begin to exit it will sell next bar
  1277. 56:49at Market or it will buy to cover next
  1278. 56:52bar at market and if we combine this
  1279. 56:55with our goat Breakout entry we can see
  1280. 56:58what this looks like on a heating oil
  1281. 57:00240 minute bar chart the system went
  1282. 57:02long on upward momentum and then starts
  1283. 57:05to lose some money so gets out of the
  1284. 57:08position the spread between the most
  1285. 57:10money the system has made and the
  1286. 57:12current money that the system has made
  1287. 57:14is greater than that threshold so the
  1288. 57:16system exits our next exit is a protect
  1289. 57:19profit ratio this is a similar idea to
  1290. 57:23our trailing stop but it's phrased a
  1291. 57:26little bit differently here if the max
  1292. 57:28position profit is greater than a
  1293. 57:30threshold of five thousand dollars per
  1294. 57:32contract the system is long and the open
  1295. 57:35position profit over the max position
  1296. 57:38profit is less than 0.5 so if you've
  1297. 57:42given back 50 percent of your gains then
  1298. 57:44get out of a position vice versa if the
  1299. 57:47market position is short if we add this
  1300. 57:50to a heating oil 240 minute bar chart
  1301. 57:53again we can see how this works the
  1302. 57:55system went short here on Lower moment
  1303. 57:56was making good money then the system
  1304. 57:59got above that profit threshold the
  1305. 58:01market started to revert higher and the
  1306. 58:04system gets out same thing happened here
  1307. 58:06system went short Market starts to
  1308. 58:08revert higher and the system gets out
  1309. 58:10because of this exit all right our next
  1310. 58:12exit is a quick Spike profit exit what
  1311. 58:17this exit does is it says if your Market
  1312. 58:20position is greater than zero if you are
  1313. 58:22long you're selling the next bar at the
  1314. 58:25close plus three percent and if your
  1315. 58:28Market position is less than zero if
  1316. 58:30you're short you're buying to cover at
  1317. 58:32the next bar minus three percent and if
  1318. 58:35we look at what this exit looks like on
  1319. 58:38a chart we can see that when you have a
  1320. 58:41big move quickly in your favor so if
  1321. 58:44you're short and the market spikes lower
  1322. 58:46or you're long and the market spikes
  1323. 58:49quickly higher you are going to exit
  1324. 58:51immediately our next exit is an ATR stop
  1325. 58:55what this code does is it says if you
  1326. 58:58are long and the market starts moving
  1327. 59:01against your position lower as defined
  1328. 59:04by this average true range over the past
  1329. 59:0710 bars times two you want to stop out
  1330. 59:09of your position vice versa if you're
  1331. 59:12short you want to buy to cover if the
  1332. 59:14market starts moving Higher by this ATR
  1333. 59:18times two values so effectively if
  1334. 59:20you're long and the market starts
  1335. 59:21dropping you hop out if you're short and
  1336. 59:23the market starts Rising you also hop
  1337. 59:26out of your position and if we add this
  1338. 59:28to a heating oil 240 minute bar chart we
  1339. 59:32can see how this works here you've
  1340. 59:34established a short position the market
  1341. 59:36starts moving higher you stop out you
  1342. 59:39get into a short position again when
  1343. 59:40momentum starts breaking lower it's a
  1344. 59:42successful trade same thing here you get
  1345. 59:44short it's a successful trade same thing
  1346. 59:47here short successful trade now you're
  1347. 59:49short and the market starts moving
  1348. 59:50against you so you stop out it's a nice
  1349. 59:53way to avoid getting short into an
  1350. 59:56overly uptrending Market two more exits
  1351. 59:58to go this is our reverse exit reverse
  1352. 1:00:02after X bars so if the bars sense
  1353. 1:00:06entries greater than 10 if you've been
  1354. 1:00:08in for 10 bars and you are long then you
  1355. 1:00:11want to go short the next bar on the
  1356. 1:00:13open and if the bar sense entry is
  1357. 1:00:16greater than 10 and you are short then
  1358. 1:00:19you want to buy the next bar on the open
  1359. 1:00:22effectively after 10 bars you want to
  1360. 1:00:25switch directions now this approach will
  1361. 1:00:28generally work well on more mean
  1362. 1:00:30reverting markets a market like cocoa or
  1363. 1:00:34coffee or Nat gas a market that you
  1364. 1:00:36already know tends to trade in the
  1365. 1:00:38sideways pattern this generally will not
  1366. 1:00:41work too well in markets that continue
  1367. 1:00:43to break out because after a certain
  1368. 1:00:45amount of time you're trading against
  1369. 1:00:47momentum for longer Trends so what this
  1370. 1:00:49looks like on a chart we can see here
  1371. 1:00:51we're buying upward momentum via our
  1372. 1:00:54goat entry our goat breakout entry after
  1373. 1:00:5710 bars we're then getting short here we
  1374. 1:01:00are getting short again and then after
  1375. 1:01:0210 bars we are getting long you can see
  1376. 1:01:05it kind of trades in these up down up
  1377. 1:01:07down patterns reversing the position
  1378. 1:01:09every 10 bars now it's time I know
  1379. 1:01:12you're as excited as I am let's look at
  1380. 1:01:15the goat the greatest of all time
  1381. 1:01:18trading exit and there it is exit number
  1382. 1:01:21one exit after a certain number of bars
  1383. 1:01:25this is a Time based exit effectively if
  1384. 1:01:29your bars since entry is greater or
  1385. 1:01:32equal to 20 so if you've been in for 20
  1386. 1:01:34bars just get out you're long you sell
  1387. 1:01:37next bar Market if you're short you buy
  1388. 1:01:39to cover next bar at Market in fact we
  1389. 1:01:42can even clean this up a bit and make
  1390. 1:01:45this one simple line of code now if we
  1391. 1:01:49add our goat stop breakout entry as
  1392. 1:01:52always we can see what this looks like
  1393. 1:01:55on a chart no surprise rise our goat
  1394. 1:01:58entry gets us long on momentum we get
  1395. 1:02:00out after 20 bars again our goat entry
  1396. 1:02:04gets us long and upward momentum and we
  1397. 1:02:06are going to get out after 20 bars so
  1398. 1:02:09when there's no other signal the system
  1399. 1:02:11will always exit after a certain amount
  1400. 1:02:14of time in this case 20 240 minute bars
  1401. 1:02:17now this might be a controversial pick
  1402. 1:02:20for the greatest of all time exit maybe
  1403. 1:02:23you like that trailing stop because it
  1404. 1:02:25helps lock in profits maybe you like
  1405. 1:02:27that reverse exit because if you think a
  1406. 1:02:30trend is over while not reverse and take
  1407. 1:02:32the other direction but believe me you
  1408. 1:02:35will find yourself using this bar sense
  1409. 1:02:37entry exit all the time it's simple it's
  1410. 1:02:40easy to test and Trends only last so
  1411. 1:02:43long it makes sense to strongly consider
  1412. 1:02:46using a time-based exit and keep in mind
  1413. 1:02:49you can layer on different exits it's
  1414. 1:02:52very common to see a strategy have two
  1415. 1:02:55or three or four four different exits
  1416. 1:02:58you can have a stop loss A take profit a
  1417. 1:03:00trailing stop and a bar since entry exit
  1418. 1:03:03all in the same strategy so you now have
  1419. 1:03:0610 great exits in addition to your 10
  1420. 1:03:09great strategy entries you can build
  1421. 1:03:12analyze test and trade thousands of
  1422. 1:03:15different systematic strategies and in
  1423. 1:03:17our next session we are going to look at
  1424. 1:03:20building some real systematic trading
  1425. 1:03:22strategies using some of these simple
  1426. 1:03:25building blocks so on to the next
  1427. 1:03:27session let's build some strategies
  1428. 1:03:32foreign
  1429. 1:03:32[Music]
  1430. 1:03:37s we looked at Great strategy entries
  1431. 1:03:41and great strategy exits and now we're
  1432. 1:03:43going to combine them we're going to
  1433. 1:03:44combine our entries with our exits to
  1434. 1:03:47take a look at some simple but robust
  1435. 1:03:50trading strategies across a diversified
  1436. 1:03:52basket of commodity Futures let's start
  1437. 1:03:55this process by running some tests we're
  1438. 1:03:57going to start by testing five of our
  1439. 1:04:00simple great entries our simple breakout
  1440. 1:04:02or simple mean reversion our low volume
  1441. 1:04:05reversal dueling momentum and the Goat
  1442. 1:04:08the greatest of all time stop breakout
  1443. 1:04:11strategy entry and we'll test those
  1444. 1:04:13strategy entries using all 10 of our
  1445. 1:04:16greatest strategy exits we'll take those
  1446. 1:04:19five strategy entries and 10 strategy
  1447. 1:04:21exits test them across 120 different bar
  1448. 1:04:25sizes ranging from 30 minutes all the
  1449. 1:04:27way up to daily bars and test all that
  1450. 1:04:30across the 25 most liquid us commodity
  1451. 1:04:33markets so overall we're going to run
  1452. 1:04:351.5 million an optimization test to find
  1453. 1:04:39some simple robust systematic trading
  1454. 1:04:41strategies that combine our great
  1455. 1:04:44strategy entries and great strategy
  1456. 1:04:46exits and I'll mention that this
  1457. 1:04:48strategy that we use to test all these
  1458. 1:04:50different exit and entry combinations is
  1459. 1:04:53our Peak Opus strategy and you can find
  1460. 1:04:57the full code for this Opus strategy in
  1461. 1:05:00the course packet available at
  1462. 1:05:03peakalgo.com so let's jump into it let's
  1463. 1:05:06look at some system strategy code
  1464. 1:05:08written in the easy language coding
  1465. 1:05:10language let's look at how these systems
  1466. 1:05:12trade on a chart and then finally let's
  1467. 1:05:15look at some profit statistics for each
  1468. 1:05:17of these five simple robust systematic
  1469. 1:05:21trading strategies our first strategy is
  1470. 1:05:23a simple breakout strategy on lean hog
  1471. 1:05:27240 minute bars what this strategy is
  1472. 1:05:30doing is if the close of one of these
  1473. 1:05:33lean hog 240 minute bars is the highest
  1474. 1:05:36lows of the last 50 then the system will
  1475. 1:05:39buy the next bar at market and vice
  1476. 1:05:42versa if the close is the lowest close
  1477. 1:05:44of the last 50 bars the system will sell
  1478. 1:05:47short next bar market and for the exit
  1479. 1:05:50we're using the reverse after a certain
  1480. 1:05:53number of bars exits so if there's no
  1481. 1:05:56other trading signal and the system is
  1482. 1:05:58long it goes short and if there's no
  1483. 1:06:00other trading signal and the system is
  1484. 1:06:02short then it goes long and of course
  1485. 1:06:04one of the big advantages of this being
  1486. 1:06:06a systematic trading strategy we can
  1487. 1:06:09simply add this trading system to a lean
  1488. 1:06:12hog 240 minute bar chart to really get a
  1489. 1:06:15sense for how the strategy works we can
  1490. 1:06:18see the system is buying higher highs
  1491. 1:06:20it's selling short lower lows and in the
  1492. 1:06:23absence of a system the system will
  1493. 1:06:25simply reverse go long reverse go short
  1494. 1:06:28reverse go long reverse go short so it
  1495. 1:06:31will buy breakouts sell breakouts and
  1496. 1:06:33then trade reversals if there's no other
  1497. 1:06:36signal and if if we look at a strategy
  1498. 1:06:38performance report we see a nice upward
  1499. 1:06:41sloping Equity curve this trading system
  1500. 1:06:44has generated positive profits of about
  1501. 1:06:47a hundred and ten thousand dollars over
  1502. 1:06:49the past 11 years running from 2010 to
  1503. 1:06:52the end of 2021 and that includes the
  1504. 1:06:56realistic costs of slippage and Brokers
  1505. 1:07:00commission to jump into a performance
  1506. 1:07:01summary there it is total net profit a
  1507. 1:07:04hundred and ten thousand dollars with a
  1508. 1:07:06profit factor of 2.23 this is a good
  1509. 1:07:09trading system our next trading system
  1510. 1:07:12is a simple mean reversion strategy on
  1511. 1:07:16Coco daily bars what this system does is
  1512. 1:07:19it says if the close of the Coco Market
  1513. 1:07:22is the highest close of the last 35 days
  1514. 1:07:25then sell short next bar at market and
  1515. 1:07:29if the close is the lowest close of the
  1516. 1:07:32last 35 days then buy next bar at mark
  1517. 1:07:37mean reversion system it's selling short
  1518. 1:07:40higher highs and it's buying lower lows
  1519. 1:07:43and there's a quick Spike profit exit if
  1520. 1:07:46the system is long and the market spikes
  1521. 1:07:49Higher by five percent the system exits
  1522. 1:07:52and if the system is short and the
  1523. 1:07:54market Falls by five percent the system
  1524. 1:07:57exits let's take a look at what this
  1525. 1:07:59system looks like on a chart using Coco
  1526. 1:08:02daily bars you can see that this system
  1527. 1:08:05is doing what we expected it is selling
  1528. 1:08:08short higher highs it is buying lower
  1529. 1:08:11lows it is generally mean reversion
  1530. 1:08:13trading in a pretty tight Channel Coco
  1531. 1:08:16is the world's number one mean reverting
  1532. 1:08:19commodity market so we would expect that
  1533. 1:08:21a mean reversion strategy like this
  1534. 1:08:23would perform pretty well let's look at
  1535. 1:08:25a strategy performance report there we
  1536. 1:08:28go that's a nice upward sloping Equity
  1537. 1:08:31curve this mean reversion approach to
  1538. 1:08:33trading Coco Futures has worked well
  1539. 1:08:36over the past 11 11 years up to 2022 and
  1540. 1:08:40if we look at a performance summary
  1541. 1:08:41there we go sixty thousand dollars in
  1542. 1:08:44profit fifty six thousand to be exact
  1543. 1:08:46with the profit factor of 2.37 again
  1544. 1:08:50another good trading system considering
  1545. 1:08:52we're just using a few lines of code and
  1546. 1:08:55a simple mean reversion trading approach
  1547. 1:08:58our next trading system is a low volume
  1548. 1:09:01reversal on Silver daily bars what this
  1549. 1:09:05system does is it says if volume is
  1550. 1:09:08lower than average and the close is the
  1551. 1:09:11lowest close of the last 35 days then
  1552. 1:09:14buy silver Futures next open at market
  1553. 1:09:17and if volume is low and the close is
  1554. 1:09:20the highest close of the last 35 days
  1555. 1:09:23then sell short silver Futures next day
  1556. 1:09:27at market and for the strategy exit
  1557. 1:09:30there is no specific exit your entry
  1558. 1:09:34acts as your exit what this means is
  1559. 1:09:36that this system is always long or short
  1560. 1:09:39the only time it exits a position is
  1561. 1:09:42when it receives a trading signal in the
  1562. 1:09:45opposite direction and if we add our
  1563. 1:09:47trading system to a silver daily bar
  1564. 1:09:50chart we can see how this system works
  1565. 1:09:53the system is buying lower closes and
  1566. 1:09:56selling short higher closes as long as
  1567. 1:09:59volume is dropping and again what we'll
  1568. 1:10:01notice is because there's no explicit
  1569. 1:10:04exit your entry acts as an exit the
  1570. 1:10:07system is always long or short the
  1571. 1:10:09system always has a position in the
  1572. 1:10:11market and if we bring up a performance
  1573. 1:10:14report there we go another nice upward
  1574. 1:10:17sloping Equity curve this trading system
  1575. 1:10:20has made
  1576. 1:10:21267 thousand dollars over the past 11
  1577. 1:10:25years including the realistic costs of
  1578. 1:10:28slippage and brokerage commission with a
  1579. 1:10:31profit factor of
  1580. 1:10:324.19 again not a bad system considering
  1581. 1:10:37it's only a few lines of code and it's
  1582. 1:10:39always in the market it is always
  1583. 1:10:41trading silver Futures our fourth
  1584. 1:10:43trading system is a dueling momentum
  1585. 1:10:46trading system on copper 360 minute bars
  1586. 1:10:50what the system does is it says if the
  1587. 1:10:52recent Market close is above the close
  1588. 1:10:55from 50 bars ago but it's also below the
  1589. 1:10:59close from a hundred bars ago then buy
  1590. 1:11:01next bar market and vice versa if the
  1591. 1:11:04close is below the close 50 bars ago but
  1592. 1:11:07above the close a hundred bars ago then
  1593. 1:11:09sell short next bar at Market basically
  1594. 1:11:12if short-term momentum is higher but
  1595. 1:11:14long-term momentum is lower than buy and
  1596. 1:11:17if short-term momentum is lower but
  1597. 1:11:19long-term momentum is higher than sell
  1598. 1:11:21short this trading system also has the
  1599. 1:11:24goat the greatest of all time strategy
  1600. 1:11:28exit it's that exit after X bars so if
  1601. 1:11:3150 bars have passed if 5360 minute bars
  1602. 1:11:35have passed and there's no other Trading
  1603. 1:11:37signal simply hop out of the position
  1604. 1:11:39and if we add our dueling momentum
  1605. 1:11:42trading system to a copper 360 minute
  1606. 1:11:46chart we can see how the system works if
  1607. 1:11:49short-term momentum starts to turn
  1608. 1:11:51higher against long-term momentum the
  1609. 1:11:54system buys there's no other signal so
  1610. 1:11:56the system gets out after 50 bars vice
  1611. 1:11:59versa you have momentum turning lower
  1612. 1:12:01here so the system sells short there's
  1613. 1:12:03no other signal so the system buys the
  1614. 1:12:05cover here and if we look at a strategy
  1615. 1:12:08performance report there we go another
  1616. 1:12:10nice upward sloping Equity curve this
  1617. 1:12:13system has made 122 thousand dollars or
  1618. 1:12:16single contract copper traded over the
  1619. 1:12:19past 11 years including the realistic
  1620. 1:12:22cost of slippage in commission with a
  1621. 1:12:24profit factor of 1.7 another good
  1622. 1:12:27trading system and for our fifth and
  1623. 1:12:30final trading system there it is the
  1624. 1:12:32goat the greatest of all time strategy
  1625. 1:12:36entry it's a stop breakout system on
  1626. 1:12:39Cotton daily bars how the system works
  1627. 1:12:42it says if we are seeing the highest
  1628. 1:12:45high of the last 45 days then buy on a
  1629. 1:12:48stop and if we see the lowest low of the
  1630. 1:12:51past 45 days then sell short on a stop
  1631. 1:12:55and this system also has a simple profit
  1632. 1:12:58Target next bar at Market exit so if the
  1633. 1:13:01max position profit on any trade is over
  1634. 1:13:05six thousand seven hundred and fifty
  1635. 1:13:07dollars then get out of the position
  1636. 1:13:09either sell next bar at Market or buy to
  1637. 1:13:11cover next bar at market and if we add
  1638. 1:13:14this strategy to a cotton daily bar
  1639. 1:13:17chart we can get a sense for how it
  1640. 1:13:20works the strategy is selling short
  1641. 1:13:22breaks lower it is buying breaks higher
  1642. 1:13:26and it has a simple profit Target
  1643. 1:13:28looking at a strategy performance report
  1644. 1:13:30we see another nice upward sloping
  1645. 1:13:33Equity curve this system has made 90 000
  1646. 1:13:37dollars over the past 11 years up to
  1647. 1:13:402022 with a profit factor of 2.72
  1648. 1:13:44another good trading system considering
  1649. 1:13:47it's just a few lines of code so there
  1650. 1:13:50it is you have five great robust
  1651. 1:13:52systematic trading strategies based on
  1652. 1:13:55our five greatest strategy entries and
  1653. 1:13:58five great strategy exits you've got a
  1654. 1:14:01simple breakout system in lean Hogs a
  1655. 1:14:03mean reversion system in Cocoa at low
  1656. 1:14:06volume reversal in silver dueling
  1657. 1:14:09momentum and copper and the Goat the
  1658. 1:14:11greatest of all time stop breakout
  1659. 1:14:13trading system in Cotton now are these
  1660. 1:14:16perfect strategies no there's no such
  1661. 1:14:19thing as a perfect trading strategy but
  1662. 1:14:21hopefully these give you a sense for the
  1663. 1:14:23type of robust systematic strategies
  1664. 1:14:26that you can build with simple building
  1665. 1:14:28blocks and the full strategy code for
  1666. 1:14:31all five of these great trading systems
  1667. 1:14:34as well as the Opus code that we use to
  1668. 1:14:37test all of these entry and exit
  1669. 1:14:39combinations is available in the course
  1670. 1:14:42packet at peakalgo.com and now that we
  1671. 1:14:45have some good robust strategies let's
  1672. 1:14:48talk about the best way to turn a good
  1673. 1:14:51strategy into a great strategy and that
  1674. 1:14:55is using filters
  1675. 1:14:59[Music]
  1676. 1:15:03you can turn good systematic trading
  1677. 1:15:06strategies into great systematic trading
  1678. 1:15:09strategies let's back up for a second in
  1679. 1:15:13our last three sessions we looked at
  1680. 1:15:15Great strategy entries and great
  1681. 1:15:18strategy exits we then combined those
  1682. 1:15:21entries and exits to build simple
  1683. 1:15:24profitable robust systematic trading
  1684. 1:15:27strategies across lean Hogs cocoa silver
  1685. 1:15:30copper and cotton but what's the next
  1686. 1:15:33step how can we turn good systematic
  1687. 1:15:36trading strategies into great systematic
  1688. 1:15:39trading strategies strategies that look
  1689. 1:15:41more like real hedge fund caliber
  1690. 1:15:44trading systems and have a much better
  1691. 1:15:47chance of generating big trading profits
  1692. 1:15:49in real time you can do all this with
  1693. 1:15:52entry filters today we'll talk about how
  1694. 1:15:55these filters work and I'll demonstrate
  1695. 1:15:57how you can Implement them into any
  1696. 1:15:59systematic trading strategy when you
  1697. 1:16:02have a very basic trade rating system
  1698. 1:16:04for example a breakout system or a mean
  1699. 1:16:07reversion system or a momentum trading
  1700. 1:16:10system you are following a very simple
  1701. 1:16:12set of rules for example with a simple
  1702. 1:16:15breakout system you are buying higher
  1703. 1:16:18highs and selling short lower lows with
  1704. 1:16:21the hope that on a long enough timeline
  1705. 1:16:23that's a profitable trading approach but
  1706. 1:16:25maybe that's not always the right
  1707. 1:16:27approach maybe there are certain
  1708. 1:16:29scenarios in which you don't want to buy
  1709. 1:16:32higher highs and don't want to sell
  1710. 1:16:34short lower lows what if you could find
  1711. 1:16:36out what those bad situations are what
  1712. 1:16:39if you could use filters to weed out
  1713. 1:16:41those bad trading setups for example
  1714. 1:16:44maybe your simple breakout system
  1715. 1:16:46shouldn't be trying to buy higher highs
  1716. 1:16:49if it's a Friday or if it's before 10 in
  1717. 1:16:52the morning or if trading volumes are
  1718. 1:16:55dropping or if volatility is increasing
  1719. 1:16:57we can test all that we can use filters
  1720. 1:17:00to answer the question should we be a
  1721. 1:17:03avoiding that trading setup the peak
  1722. 1:17:06filters that we'll talk about today test
  1723. 1:17:08hundreds of different Market scenarios
  1724. 1:17:11and price patterns to find what are
  1725. 1:17:13those situations that you might want to
  1726. 1:17:16avoid to increase your system's
  1727. 1:17:18profitability so you get a sense for
  1728. 1:17:20what these filters are how they could
  1729. 1:17:22help us avoid bad trading setups now
  1730. 1:17:25let's look at a practical example for
  1731. 1:17:27the heating oil Market where we can take
  1732. 1:17:29a good breakout trading system and turn
  1733. 1:17:32it into a great breakout trading system
  1734. 1:17:35there are four simple steps that we are
  1735. 1:17:38going to follow first we are going to
  1736. 1:17:40add the peak filter script to our
  1737. 1:17:43strategy next we are going to test the
  1738. 1:17:45entry filters we are then going to
  1739. 1:17:47permanently move the filters into our
  1740. 1:17:50strategy and finally we are going to
  1741. 1:17:52remove the filter script that we added
  1742. 1:17:54earlier so let's jump into tradestation
  1743. 1:17:56and look at a very simple breakout
  1744. 1:17:58strategy for the heating oil Market on
  1745. 1:18:00240 minute bars what this strategy does
  1746. 1:18:03does is it buys higher highs looking
  1747. 1:18:06back at the last 50 bars and it sells
  1748. 1:18:09short lower lows looking also back at
  1749. 1:18:11the last 50 bars the strategy then exits
  1750. 1:18:14so it either sells the position or buys
  1751. 1:18:16to cover that heating oil position using
  1752. 1:18:18a slightly different length the shorter
  1753. 1:18:20length of only 15 bars there's also a
  1754. 1:18:23profit Target of three thousand dollars
  1755. 1:18:25per contract and a stop loss of a fifth
  1756. 1:18:28of that three thousand dollars per
  1757. 1:18:30contract so six hundred dollars per
  1758. 1:18:32contract and if we look at some
  1759. 1:18:34performance statistics we can see a nice
  1760. 1:18:36upward sloping Equity curve so
  1761. 1:18:38cumulative profits have accrued nicely
  1762. 1:18:41over time with very few drawdowns and
  1763. 1:18:43this system has made about a hundred and
  1764. 1:18:46twenty eight thousand dollars including
  1765. 1:18:48slippage and including commission costs
  1766. 1:18:50over the past 10 years so we know we're
  1767. 1:18:52starting with a pretty good breakout
  1768. 1:18:55strategy in heating oil now let's add
  1769. 1:18:57the peak filter script so that we can
  1770. 1:19:00start testing which of those filters we
  1771. 1:19:03ultimately want to add to the strategy
  1772. 1:19:05to make it even better so this is what
  1773. 1:19:07the peak filter script looks like that
  1774. 1:19:10we'll be adding to our strategy what
  1775. 1:19:12we're going to do is take this simple
  1776. 1:19:14script and wrap it around the very first
  1777. 1:19:17entry that we want to test so to do that
  1778. 1:19:20we simply copy the script we paste it
  1779. 1:19:22into our strategy to wrap it around the
  1780. 1:19:26very first entry and now we confirm and
  1781. 1:19:29we are good to go we can now test
  1782. 1:19:31different entry filters on that first
  1783. 1:19:33entry now you'll see in our strategy we
  1784. 1:19:36have a new input called the filter input
  1785. 1:19:39what we're going to do is we are going
  1786. 1:19:40to optimize that new input with a value
  1787. 1:19:43from 1 to 500 to see which of those
  1788. 1:19:47price patterns or Market scenarios we
  1789. 1:19:50should best be avoiding in our strategy
  1790. 1:19:52our optimization is now done running if
  1791. 1:19:55we look at our optimization report and
  1792. 1:19:57sort by net profit we can see that the
  1793. 1:20:00two best filters are number 140 31 and
  1794. 1:20:04number 91 so we've run our optimization
  1795. 1:20:07test across hundreds of different Market
  1796. 1:20:09scenarios and price patterns and it
  1797. 1:20:12tells us that number 91 and number 141
  1798. 1:20:16are the filters that work best those are
  1799. 1:20:19the market scenarios that we want to
  1800. 1:20:21avoid to improve the performance of our
  1801. 1:20:24strategy so let's move on to step number
  1802. 1:20:28three let's find those filters look at
  1803. 1:20:31what they are and move them permanently
  1804. 1:20:33into our breakout strategy code we now
  1805. 1:20:36want to find the strategy code for the
  1806. 1:20:39filters that we're looking for so we go
  1807. 1:20:41to our Peak filter function and remember
  1808. 1:20:44we want to look for Filter Number 91
  1809. 1:20:47there it is if the adx value is greater
  1810. 1:20:51than 30 that is a situation that we want
  1811. 1:20:54our code to avoid so here we write if
  1812. 1:20:5780x greater than 30 equals false and
  1813. 1:21:00next we want to look for the other
  1814. 1:21:01filter that worked well for Forest that
  1815. 1:21:03was number 141 so there it is this is an
  1816. 1:21:07up range filter again we simply copy the
  1817. 1:21:10filter we paste the actual strategy code
  1818. 1:21:12into our strategy as a situation we want
  1819. 1:21:15to avoid so false and we tell our script
  1820. 1:21:18to begin if both of those filters are
  1821. 1:21:21false now if we confirm our strategy we
  1822. 1:21:25can immediately see the impact that this
  1823. 1:21:27has on strategy performance there we go
  1824. 1:21:30we can see our Equity curve looks even
  1825. 1:21:33better this strategy has now made 175
  1826. 1:21:37000 including slippage including
  1827. 1:21:39commission costs instead of the 128
  1828. 1:21:43000 from just the simple code we can now
  1829. 1:21:45repeat this process that we did for the
  1830. 1:21:48buying entry on the selling short entry
  1831. 1:21:51so again we just wrap our testing script
  1832. 1:21:54around the cell short entry we confirm
  1833. 1:21:57our strategy and we're going to optimize
  1834. 1:22:00that same filter value from a value of
  1835. 1:22:04one to five hundred to test those 500
  1836. 1:22:07different Market scenarios and price
  1837. 1:22:09patterns our optimization is now done
  1838. 1:22:12running same process as before we take
  1839. 1:22:14the filters that performed best and we
  1840. 1:22:17simply paste those filters from the
  1841. 1:22:18function into our strategy and confirm
  1842. 1:22:22that strategy now if we jump back into a
  1843. 1:22:26strategy performance report we can see
  1844. 1:22:28that performance continues to improve
  1845. 1:22:30those filters are working we now have an
  1846. 1:22:33even better Equity curve now making a
  1847. 1:22:35little over a hundred and eighty
  1848. 1:22:37thousand dollars over the past 10 years
  1849. 1:22:39now for step number four we can jump
  1850. 1:22:42back into our strategy and remove the
  1851. 1:22:45filter script that we had added earlier
  1852. 1:22:47just to clean things up a little bit if
  1853. 1:22:50we confirm our strategy go look at a
  1854. 1:22:52strategy performance report we can see
  1855. 1:22:55that the strategy is unchanged right
  1856. 1:22:57it's the same performance so we've now
  1857. 1:22:59done a good job of cleaning up our
  1858. 1:23:01strategy to use going forward with those
  1859. 1:23:04new filters so we now have what looks
  1860. 1:23:06like a pretty good systematic trading
  1861. 1:23:09strategy for the heating oil Market we
  1862. 1:23:12took a good simple breakout trading
  1863. 1:23:15strategy and turned it into a great
  1864. 1:23:17filtered breakout strategy this strategy
  1865. 1:23:19looks like a great profitable hedge fund
  1866. 1:23:23caliber breakout systematic trading
  1867. 1:23:26system this back-tested strategy has
  1868. 1:23:29made positive profit including the
  1869. 1:23:32realistic costs of Market slippage and
  1870. 1:23:34brokerage Commissions in 11 of the past
  1871. 1:23:3712 years now the big question here is
  1872. 1:23:41this optimization are we over optimizing
  1873. 1:23:44our trading system by using these
  1874. 1:23:47filters and therefore guaranteeing that
  1875. 1:23:50the strategy will not work very well
  1876. 1:23:52going forward and the answer is not
  1877. 1:23:55really we're not tweaking the inputs and
  1878. 1:23:57over optimizing the inputs of the
  1879. 1:24:00trading system to get that perfect
  1880. 1:24:02backward looking Equity curve we're not
  1881. 1:24:05over optimizing inputs rather we're
  1882. 1:24:07using filters to avoid bad trading
  1883. 1:24:10setups situations in which it's just not
  1884. 1:24:13profitable to establish a trading
  1885. 1:24:16position so we end up trading less but
  1886. 1:24:18the situations where we do trade are
  1887. 1:24:21more profitable trading setups which is
  1888. 1:24:24a pretty good situation to be in and
  1889. 1:24:26something very cool about these filters
  1890. 1:24:29is that these filters will often work
  1891. 1:24:31across a lot of different markets for
  1892. 1:24:34example this exact strategy same code
  1893. 1:24:37same input values same filters also
  1894. 1:24:41works in heating oil in gold in Platinum
  1895. 1:24:45and crude oil that should give you more
  1896. 1:24:47confidence that we've truly taken a good
  1897. 1:24:49breakout trading strategy and turned it
  1898. 1:24:51into a great breakout strategy a
  1899. 1:24:54strategy that works across a lot of
  1900. 1:24:56different markets and if you're
  1901. 1:24:57wondering where you can get this peak
  1902. 1:25:00filter code there is a version of our
  1903. 1:25:04Peak filter code available in the
  1904. 1:25:06strategy package at peakalgo.com and the
  1905. 1:25:10full Peak filter code with hundreds of
  1906. 1:25:13different Market scenarios and price
  1907. 1:25:16pattern filters is available for annual
  1908. 1:25:18subscribers at peakalgo.com so we've
  1909. 1:25:22taken great strategy entries great
  1910. 1:25:25strategy exits we've combined them to
  1911. 1:25:28create some simple robust profitable
  1912. 1:25:31systematic trading strategies and we've
  1913. 1:25:33talked about how you can use entry
  1914. 1:25:36filters to turn those good strategies
  1915. 1:25:38into great strategies so you have a
  1916. 1:25:41really good idea how you can build
  1917. 1:25:43profitable high quality hedge fund
  1918. 1:25:46caliber trading systems now let's move
  1919. 1:25:49on and talk about optimization and how
  1920. 1:25:52we can give our systematic trading
  1921. 1:25:55strategies the best chance of Performing
  1922. 1:25:58well going forward we've now finished
  1923. 1:26:00our section on strategy building blocks
  1924. 1:26:04and we're going to move on to our next
  1925. 1:26:06section on strategy optimization
  1926. 1:26:08incubation and portfolio construction
  1927. 1:26:10everything that we'll go through in the
  1928. 1:26:13next few sessions including the
  1929. 1:26:15correlation spreadsheet from the section
  1930. 1:26:17on portfolio construction as well as all
  1931. 1:26:20the cheat sheets from this section on
  1932. 1:26:22best algo markets to trade are available
  1933. 1:26:25in the course packet at peakalgo.com and
  1934. 1:26:30in terms of our overall systematic
  1935. 1:26:32trading strategy development process we
  1936. 1:26:35are going to cover a lot of ground in
  1937. 1:26:38these next sessions we'll be talking
  1938. 1:26:39about testing and optimization real-time
  1939. 1:26:42incubation and portfolio and risk
  1940. 1:26:45analysis let's move on to our next full
  1941. 1:26:48section optimization incubation and
  1942. 1:26:51portfolio Construction
  1943. 1:26:54foreign
  1944. 1:26:55[Music]
  1945. 1:27:00we've now covered entries exits filters
  1946. 1:27:03those fundamental building blocks of
  1947. 1:27:05successful systematic training
  1948. 1:27:07strategies let's move on and talk about
  1949. 1:27:10optimization specifically some of the
  1950. 1:27:13pitfalls of optimization and the steps
  1951. 1:27:15that we can take to avoid them now what
  1952. 1:27:18is optimization optimization is changing
  1953. 1:27:21a trading system to make it more
  1954. 1:27:23effective to make it more profitable and
  1955. 1:27:26for systematic trading that means
  1956. 1:27:28testing the strategies inputs to see if
  1957. 1:27:31that improves strategy performance and
  1958. 1:27:34in the book design testing and
  1959. 1:27:36optimization of trading systems the
  1960. 1:27:39author Robert Pardo says the goal of
  1961. 1:27:41optimization is to find the values for
  1962. 1:27:44model parameters that will generate Peak
  1963. 1:27:46trading performance in real time that's
  1964. 1:27:49a really important distinction that
  1965. 1:27:51we're going to come back to again and
  1966. 1:27:53again in this session the goal of
  1967. 1:27:55optimization is not to create the
  1968. 1:27:58perfect trading system of the perfect
  1969. 1:28:00upward sloping Equity curve the goal is
  1970. 1:28:03to find a set of parameters that best
  1971. 1:28:05sets your strategy up to perform well
  1972. 1:28:08and generate profits in real time now
  1973. 1:28:11how can we do that and what does good
  1974. 1:28:13optimization look like if you are using
  1975. 1:28:16a professional systematic trading
  1976. 1:28:18platform like tradestation multi-charts
  1977. 1:28:21metatrader trading view system parameter
  1978. 1:28:24optimization is always a very
  1979. 1:28:27straightforward process if we jump into
  1980. 1:28:29the trade station trading platform we
  1981. 1:28:32can look at a simple breakout strategy
  1982. 1:28:35for the gasoline market and the first
  1983. 1:28:37thing we'll notice is that there are
  1984. 1:28:39four inputs four parameters at the very
  1985. 1:28:42top of the strategy that we can optimize
  1986. 1:28:45there's a length for buying the market a
  1987. 1:28:48length for selling short the market a
  1988. 1:28:50stop value and a bars sense entry exit
  1989. 1:28:54value and if we add this trading system
  1990. 1:28:56to a gasoline daily bar chart we can see
  1991. 1:28:59that this breakout trading system has
  1992. 1:29:02worked pretty well for the gasoline
  1993. 1:29:04Futures Market it successfully sold
  1994. 1:29:06short lower lows it's been buying higher
  1995. 1:29:09highs for a profit and if we look at a
  1996. 1:29:11strategy performance report we see a
  1997. 1:29:14nice upward sloping Equity curve this is
  1998. 1:29:17generally been a profitable approach to
  1999. 1:29:19trading the gasoline Market but what if
  2000. 1:29:22we want to try and improve this strategy
  2001. 1:29:24performance what if we want to test if
  2002. 1:29:27maybe buying the highest close of the
  2003. 1:29:29last 12 days or 15 days or 20 days could
  2004. 1:29:33improve our strategy performance to do
  2005. 1:29:36that we'll simply jump into the strategy
  2006. 1:29:39and we're going to do this again in
  2007. 1:29:41tradestation but this is the same
  2008. 1:29:43process regardless of the automated
  2009. 1:29:45trading platform that you're using we go
  2010. 1:29:48to our parameters our inputs and we can
  2011. 1:29:51optimize for example we can test this
  2012. 1:29:53from a value of 5 to 15 in increments of
  2013. 1:29:57one and we can test our other length in
  2014. 1:29:59increments of 5 from 25 to 75. our
  2015. 1:30:03strategy optimization is now done
  2016. 1:30:06running if we look at a strategy
  2017. 1:30:08performance report we see a nice upward
  2018. 1:30:10sloping Equity curve a slightly improved
  2019. 1:30:13Equity curve and if we go to a strategy
  2020. 1:30:16optimization report we can see that this
  2021. 1:30:19report tells us if we sort by net profit
  2022. 1:30:22that buying an eight day breakout so
  2023. 1:30:25buying the highest close of the past
  2024. 1:30:27eight sessions and selling short the
  2025. 1:30:30lowest close of the past 75 sessions is
  2026. 1:30:33actually the best parameters to use
  2027. 1:30:36again instead of using 10 here using 8
  2028. 1:30:39and instead of using 50 here for our
  2029. 1:30:42strategy optimization report using a
  2030. 1:30:44value of 75. now that we've done our
  2031. 1:30:46optimization the million dollar question
  2032. 1:30:49what will be the best parameters to use
  2033. 1:30:52going forward now our optimization test
  2034. 1:30:54told us that using 8 instead of 10 and
  2035. 1:30:5775 instead of 50 were the best
  2036. 1:31:00historical parameters to use but will
  2037. 1:31:03those be the best parameter values for
  2038. 1:31:05Peak strategy performance going forward
  2039. 1:31:08the answer frustratingly is almost
  2040. 1:31:11certainly not that value of 8 and 75
  2041. 1:31:14will most likely not be the most
  2042. 1:31:17profitable values to use for the next 10
  2043. 1:31:19years but our strategy optimization
  2044. 1:31:22report gives us some important Clues as
  2045. 1:31:25to what those most profitable parameters
  2046. 1:31:28might be if we jump back into our
  2047. 1:31:30strategy optimization report sorted by
  2048. 1:31:34net profit we see that for our breakout
  2049. 1:31:37buying entries so again that is our if
  2050. 1:31:40the close is the highest close of length
  2051. 1:31:43x we see that that length x value there
  2052. 1:31:46are a lot of optimized values of eight
  2053. 1:31:49of nine of ten and for the selling short
  2054. 1:31:52side we see 75 65 show up quite a bit
  2055. 1:31:56not so much any values that are in the
  2056. 1:31:59low 50s so for amending our trading
  2057. 1:32:03system we might want to change this
  2058. 1:32:06length y value to something around 70
  2059. 1:32:09but still keep our length x around 10.
  2060. 1:32:12again our optimization report showed us
  2061. 1:32:15that 8 was the optimized value but we
  2062. 1:32:17saw a lot of values that were hanging
  2063. 1:32:19out around 10. now that zone where we
  2064. 1:32:22see the highest optimized profits using
  2065. 1:32:25a length x value of 8 or 9 or 10 and a
  2066. 1:32:29length y value of 65 or 70 or 75 that is
  2067. 1:32:34what's called a global Maxima that's the
  2068. 1:32:37zone that we want to be in that's the
  2069. 1:32:39area that we want to choose our best
  2070. 1:32:42parameters from another way to say that
  2071. 1:32:44same idea is that's a good neighborhood
  2072. 1:32:47to be in if we choose parameter values
  2073. 1:32:50of 10 in 60 or 9 and 75 we're generally
  2074. 1:32:55going to have a system that holds up
  2075. 1:32:57much better going forward than if we
  2076. 1:32:59were to use parameters from outside that
  2077. 1:33:02neighborhood parameters from away from
  2078. 1:33:04the global maximum now optimization is a
  2079. 1:33:07great tool but it comes with a big
  2080. 1:33:10warning and that is it is very easy and
  2081. 1:33:13very tempting to over optimize your
  2082. 1:33:16trading systems when you add lots of
  2083. 1:33:18inputs to a trading system when you
  2084. 1:33:21optimize those inputs again and again
  2085. 1:33:23across hundreds or thousands of
  2086. 1:33:26different optimization runs you are over
  2087. 1:33:28optimizing you are curve fitting and
  2088. 1:33:31whether you intend to or not you are
  2089. 1:33:34ensuring that your trading system will
  2090. 1:33:36not work well going forward there are
  2091. 1:33:40real diminishing returns to optimizing
  2092. 1:33:42your trading systems and that point
  2093. 1:33:45where there's no marginal advantage to
  2094. 1:33:47playing around with your inputs and
  2095. 1:33:49doing more optimizations is a lot closer
  2096. 1:33:52than you might think for a great analogy
  2097. 1:33:55about optimization and the hazards of
  2098. 1:33:58over optimization let's talk about
  2099. 1:34:00surfing if you want to learn to surf and
  2100. 1:34:03you go to Hawaii or Bali or California
  2101. 1:34:07your surfing instructor is going to set
  2102. 1:34:09you up with a basic set of rules for how
  2103. 1:34:12to ride a wave and on your first day you
  2104. 1:34:15go out you have a great time you catch a
  2105. 1:34:18few waves and at the end of the day you
  2106. 1:34:20recall okay I caught my best waves at 12
  2107. 1:34:2319 at 123 and at 2 49. and if you go out
  2108. 1:34:28on your second day at exactly those
  2109. 1:34:31times expecting to catch those same
  2110. 1:34:34Great Waves you are not going to have a
  2111. 1:34:37very good time you would be better off
  2112. 1:34:39following that simple set of rules again
  2113. 1:34:42and again that your instructor told you
  2114. 1:34:44now of course the reason you didn't have
  2115. 1:34:47a good second day of Surfing is you over
  2116. 1:34:50optimized you wrongly assume that
  2117. 1:34:52following a very specific set of
  2118. 1:34:54parameters would give you a better
  2119. 1:34:56surfing experience than just following a
  2120. 1:34:59simple set of rules now this is a great
  2121. 1:35:02analogy because markets move in waves
  2122. 1:35:04and you can catch those waves you can
  2123. 1:35:07capture those Market moves for a profit
  2124. 1:35:10if you follow a simple set of
  2125. 1:35:12instructions don't let great be the
  2126. 1:35:14enemy of the good don't ruin a good
  2127. 1:35:17trading system by trying to make it a
  2128. 1:35:20perfect trading system so how can you
  2129. 1:35:23avoid over optimization how can you
  2130. 1:35:25avoid the hazards of curve fitting first
  2131. 1:35:28keep your strategies simple your biggest
  2132. 1:35:31Advantage is being able to trade a
  2133. 1:35:34portfolio of good uncorrelated real-time
  2134. 1:35:37systematic trading strategies that is
  2135. 1:35:40such an important point that comes up
  2136. 1:35:42again and again in this course I'm gonna
  2137. 1:35:45say it again your biggest Advantage as a
  2138. 1:35:48systematic Trader especially in
  2139. 1:35:50commodity markets is being able to trade
  2140. 1:35:53a diversified portfolio of uncorrelated
  2141. 1:35:57real-time trading systems so again spend
  2142. 1:36:01your time trying to find good trading
  2143. 1:36:03systems across more markets especially
  2144. 1:36:07uncorrelated markets like commodity
  2145. 1:36:09markets instead of trying to build that
  2146. 1:36:11perfect over optimized curve fitted
  2147. 1:36:14trading system the second way to avoid
  2148. 1:36:17over optimization is to use more
  2149. 1:36:20out-of-sample data out of sample data is
  2150. 1:36:23data that your strategy has not had
  2151. 1:36:26access to historical data that your
  2152. 1:36:28system has not yet seen and a popular
  2153. 1:36:31way to test on out-of-sample data is
  2154. 1:36:34called walk forward testing now walk
  2155. 1:36:37forward testing is where for example you
  2156. 1:36:40optimize your strategy parameters for a
  2157. 1:36:44very limited period of time for example
  2158. 1:36:46from 2011 to 2015 then you see how those
  2159. 1:36:51parameters perform on a period after
  2160. 1:36:54that for example
  2161. 1:36:562016. you then repeat that process over
  2162. 1:36:59and over again so that you're constantly
  2163. 1:37:02seeing if the parameters that you tested
  2164. 1:37:05for in the past have a predictive value
  2165. 1:37:08for positive performance in the future
  2166. 1:37:11now obviously you can do this process
  2167. 1:37:14manually you could just load up a very
  2168. 1:37:16specific window of time in your trading
  2169. 1:37:19platform optimize see how those
  2170. 1:37:22parameters work on a period after that
  2171. 1:37:24and repeat that process over and over
  2172. 1:37:27again there are also walk forward
  2173. 1:37:29testing engines in most automated
  2174. 1:37:31trading platforms and if you're a
  2175. 1:37:33tradestation user there's a great walk
  2176. 1:37:36forward testing tool that you can use
  2177. 1:37:38called multi-op that you can find at
  2178. 1:37:41multi-op.net and if you don't want to go
  2179. 1:37:43down the full walk forward route you can
  2180. 1:37:45also just optimize your parameters on a
  2181. 1:37:48limited set of data for example you can
  2182. 1:37:51optimize your trading system parameters
  2183. 1:37:53from 2010 to 2020 and then see how those
  2184. 1:37:57parameters perform on real-time data
  2185. 1:38:00data your strategy has not yet seen from
  2186. 1:38:032020 after the third and final way to
  2187. 1:38:07avoid over optimization is to make sure
  2188. 1:38:09that your trading system is consistent
  2189. 1:38:12with your understanding of Market
  2190. 1:38:14participants and how the market moves
  2191. 1:38:17for example if you have a seasonal
  2192. 1:38:20trading system that sells short corn
  2193. 1:38:22Futures in June or July after that
  2194. 1:38:26critical production window when Harvest
  2195. 1:38:28ramps up and Farmers start to get more
  2196. 1:38:31confidence in the final size of their
  2197. 1:38:33crop and Traders remove a risk premium
  2198. 1:38:36from Futures you do not have as much
  2199. 1:38:38risk of over optimizing that trading
  2200. 1:38:41system you don't need to add a lot of
  2201. 1:38:43inputs you don't need to tweak those
  2202. 1:38:45inputs you have the confidence that you
  2203. 1:38:48understand fundamentally why that trade
  2204. 1:38:50works or maybe you use commitment of
  2205. 1:38:52Traders positioning data to trade or
  2206. 1:38:55whether or cash basis the more you
  2207. 1:38:58understand how Market works and how you
  2208. 1:39:01can Model A Trading System around that
  2209. 1:39:04the less likely you are to have to over
  2210. 1:39:06optimize a trading system to get the
  2211. 1:39:09kind of performance statistics that you
  2212. 1:39:11want so putting it all together
  2213. 1:39:13optimization is a powerful tool but that
  2214. 1:39:16optimization button is the devil's
  2215. 1:39:19button it can get you into a lot of
  2216. 1:39:21trouble there is always a real risk of
  2217. 1:39:24over optimization of curve fitting and
  2218. 1:39:27we can avoid some of those risks by
  2219. 1:39:29thinking like a surfer by trying to
  2220. 1:39:32catch waves using a simple set of rules
  2221. 1:39:35by being smart about how we use out of
  2222. 1:39:38sample data and finally trying to build
  2223. 1:39:40our simple systems based on a
  2224. 1:39:43fundamental understanding of how markets
  2225. 1:39:46work and remember I'll say it a third
  2226. 1:39:48time your advantage as a systematic
  2227. 1:39:51Trader is not in building that one
  2228. 1:39:54perfect over optimized trading system
  2229. 1:39:57it's in creating a portfolio Leo of
  2230. 1:40:00Diversified real-time uncorrelated
  2231. 1:40:04systematic trading strategies
  2232. 1:40:09[Music]
  2233. 1:40:13some commodity markets are way better to
  2234. 1:40:16trade than others commodity markets all
  2235. 1:40:18move in very different ways in response
  2236. 1:40:21to different fundamental and
  2237. 1:40:23non-fundamental price drivers especially
  2238. 1:40:25if you are a beginner to systematic
  2239. 1:40:27trading with limited capital or limited
  2240. 1:40:30risk tolerance it is very important to
  2241. 1:40:33know these differences some markets are
  2242. 1:40:35too expensive to trade they have too
  2243. 1:40:37much slippage some commodity Futures
  2244. 1:40:40contracts are really large Futures
  2245. 1:40:42contracts so they require a lot of
  2246. 1:40:44capital and margin to trade some
  2247. 1:40:46contracts are very volatile and have a
  2248. 1:40:48lot of what's called value at risk and
  2249. 1:40:51finally some commodity markets are way
  2250. 1:40:53better for breakout trading and some are
  2251. 1:40:56better for mean reversion trading so
  2252. 1:40:58let's talk about quantitatively how we
  2253. 1:41:01can prove which commodity markets are
  2254. 1:41:03the best for trading and why for example
  2255. 1:41:06you might want to avoid trading markets
  2256. 1:41:09like Palladium and gold and favor
  2257. 1:41:11trading markets like sugar and platinum
  2258. 1:41:14what are the best commodity markets to
  2259. 1:41:16trade let's start by talking about
  2260. 1:41:18slippage slippage is the cost of
  2261. 1:41:21executing a Futures trade when you trade
  2262. 1:41:24commodity Futures there is always a bid
  2263. 1:41:27ask spread there's always a cost to
  2264. 1:41:30executing that trade and every commodity
  2265. 1:41:33Market is different every Market has a
  2266. 1:41:35different amount of slippage a different
  2267. 1:41:37cost you're going to pay to execute a
  2268. 1:41:40trade and most of that has to do with
  2269. 1:41:42liquidity really liquid markets have low
  2270. 1:41:46slippage really illiquid markets with
  2271. 1:41:48fewer participants less volume traded
  2272. 1:41:51have very high slippage very high cost
  2273. 1:41:53to trade for example illiquid markets
  2274. 1:41:56like Lumber or orange juice or Palladium
  2275. 1:41:59or Rice have very few participants not a
  2276. 1:42:03lot of volume a large amount of slippage
  2277. 1:42:05you're going to pay a lot to execute a
  2278. 1:42:08trade but bigger markets like gold
  2279. 1:42:10Platinum copper crude oil have lot of
  2280. 1:42:13Market participants a lot of liquidity a
  2281. 1:42:16low amount of slippage a low cost to
  2282. 1:42:19trade so it follows that when you
  2283. 1:42:21include the cost of slippage in your
  2284. 1:42:24system development which you always
  2285. 1:42:26should include you are going to find it
  2286. 1:42:28easier to build systems for those more
  2287. 1:42:31liquid markets this is one of my
  2288. 1:42:33personal biggest pet peeves with
  2289. 1:42:36strategy development is when I see
  2290. 1:42:38Traders Traders not including those
  2291. 1:42:41costs of slippage and commissions when
  2292. 1:42:43they are building strategies testing
  2293. 1:42:46strategies sharing strategies via email
  2294. 1:42:48or YouTube at Peak trading research we
  2295. 1:42:51will always include those costs of
  2296. 1:42:54slippage and commissions because you
  2297. 1:42:56cannot avoid those costs they are a
  2298. 1:42:58realistic part of trading if your system
  2299. 1:43:01doesn't look good when you include
  2300. 1:43:02slippage and commission costs guess what
  2301. 1:43:05you should not be trading that system it
  2302. 1:43:07will not make money for you in real time
  2303. 1:43:09every system that we build on this
  2304. 1:43:12channel on the Peak trading research
  2305. 1:43:14channel will always include slippage and
  2306. 1:43:17commission costs for example from our
  2307. 1:43:19strategy of the month videos including
  2308. 1:43:22the realistic costs of slippage and
  2309. 1:43:24commissions including the realistic cost
  2310. 1:43:27of slippage and commissions and that
  2311. 1:43:30includes most importantly includes the
  2312. 1:43:33realistic costs of slippage and
  2313. 1:43:36commissions you get the idea always
  2314. 1:43:39include slippage and commission costs
  2315. 1:43:41when you are developing strategies so in
  2316. 1:43:44terms of slippage and liquidity what are
  2317. 1:43:48those best markets to trade and what are
  2318. 1:43:50those markets to avoid if we take a
  2319. 1:43:53chart and we model on the y-axis the
  2320. 1:43:57volatility of a Futures Contract and on
  2321. 1:44:00the x-axis we model the slippage as a
  2322. 1:44:04percentage of notional so the cost of
  2323. 1:44:06executing a Futures trade we can see
  2324. 1:44:09very clearly that there are some markets
  2325. 1:44:12that are liquid and volatile those fall
  2326. 1:44:15into that nice green zone in the upper
  2327. 1:44:18left there are other markets that are
  2328. 1:44:20more E-liquid and stable they fall into
  2329. 1:44:23the bottom right part of the chart
  2330. 1:44:25generally speaking you are going to have
  2331. 1:44:27an easier time developing profitable
  2332. 1:44:30systematic trading strategies especially
  2333. 1:44:33breakout and momentum trading strategies
  2334. 1:44:35for the markets that fall into that nice
  2335. 1:44:38green zone the markets in that green
  2336. 1:44:41zone They are volatile they are also
  2337. 1:44:44liquid there's a low cost to execute
  2338. 1:44:47trades a low amount of slippage meaning
  2339. 1:44:49you are getting the best bang for the
  2340. 1:44:52buck you are not going to pay a lot of
  2341. 1:44:54slippage but you're going to get a lot
  2342. 1:44:56of volatility big moves that you can
  2343. 1:44:59profit from now this idea that some
  2344. 1:45:01markets are very volatile and better for
  2345. 1:45:04breakout trading some are less volatile
  2346. 1:45:07and better for mean reversion trading
  2347. 1:45:09that's a concept we are going to come
  2348. 1:45:11back to later in in this section this
  2349. 1:45:14means that just in terms of slippage and
  2350. 1:45:16volatility you are likely going to be
  2351. 1:45:19favoring markets like Nat gas heating
  2352. 1:45:21oil gasoline coffee Platinum sugar
  2353. 1:45:25soybean oil what are the best commodity
  2354. 1:45:27markets to trade let's talk about
  2355. 1:45:30contract size commodity contracts all
  2356. 1:45:33have different notional dollar values
  2357. 1:45:35and those values are always changing
  2358. 1:45:38depending on the value of the underlying
  2359. 1:45:40commodity for example for gold every
  2360. 1:45:44gold Futures Contract references the
  2361. 1:45:47delivery of a hundred troy ounces and
  2362. 1:45:51one ounce of gold is worth two thousand
  2363. 1:45:54dollars so a hundred ounces two thousand
  2364. 1:45:57dollars an ounce every Futures Contract
  2365. 1:45:59of gold is worth two hundred thousand
  2366. 1:46:02dollars that is a big contract which
  2367. 1:46:05means you are going to need to have a
  2368. 1:46:08big trading account that's able to post
  2369. 1:46:10a big amount of initial and maintenance
  2370. 1:46:12margin on the flip side a contract of
  2371. 1:46:16sugar or cocoa or Nat gas is worth about
  2372. 1:46:19twenty thousand dollars so about a tenth
  2373. 1:46:22the value of a contract of gold so as
  2374. 1:46:25you can see there are some big
  2375. 1:46:27differences here so whether you are a
  2376. 1:46:29beginner and have a smaller trading
  2377. 1:46:31account or a limited amount of capital
  2378. 1:46:33or you are a professional CTA portfolio
  2379. 1:46:37manager and you have in the back of your
  2380. 1:46:39head that trading one contract of gold
  2381. 1:46:41is pretty much the same notional
  2382. 1:46:43exposure is trading 10 contracts of oats
  2383. 1:46:47or cocoa is very important to know these
  2384. 1:46:49differences now that is notional dollar
  2385. 1:46:53value but what about risk what if you
  2386. 1:46:56have a very big contract that has low
  2387. 1:46:59volatility or a very small contract that
  2388. 1:47:02has very high volatility how do you
  2389. 1:47:05adjust for that how do you account for
  2390. 1:47:06the differences in risk a really good
  2391. 1:47:09way to do that is to look at Dollar
  2392. 1:47:12standard deviation or value at risk
  2393. 1:47:15what's called VAR now before Peak
  2394. 1:47:18trading research I was a professional
  2395. 1:47:20commodity Trader for Cargill one of the
  2396. 1:47:23world's largest commercial grain trading
  2397. 1:47:25companies I've also traded for a few
  2398. 1:47:28different hedge funds and my risk has
  2399. 1:47:30never been measured in number of
  2400. 1:47:32contracts or notional value it's always
  2401. 1:47:35been measured in VAR value at risk
  2402. 1:47:38basically what is my dollar notional
  2403. 1:47:41exposure times the standard deviation of
  2404. 1:47:45that asset of that commodity future and
  2405. 1:47:48if we were to list commodity Futures in
  2406. 1:47:51terms of VAR in terms of contract risk
  2407. 1:47:55so notional value times standard
  2408. 1:47:57deviation we can see that some contracts
  2409. 1:48:00have huge risk Palladium heating oil
  2410. 1:48:03gasoline these are markets that not only
  2411. 1:48:06have a big notional contract but a lot
  2412. 1:48:09of volatility and of course other
  2413. 1:48:10markets are way at the bottom of the
  2414. 1:48:13scale markets like cattle corn rice
  2415. 1:48:16cocoa lower notional values lower risk
  2416. 1:48:19so especially when you make that
  2417. 1:48:21transition from system building and
  2418. 1:48:23system testing into live trading you
  2419. 1:48:26need to know these differences you need
  2420. 1:48:29to know that some contracts are bigger
  2421. 1:48:31than others require more capital and
  2422. 1:48:33more margin to trade some are more
  2423. 1:48:36volatile than others and those bigger
  2424. 1:48:38more volatile contracts could have an
  2425. 1:48:41outsized influence on the value of your
  2426. 1:48:43portfolio and you might want to trade
  2427. 1:48:46five or six or seven contracts of cattle
  2428. 1:48:49for every contract of gasoline that
  2429. 1:48:52you're trading in another system and
  2430. 1:48:54finally what are the best commodity
  2431. 1:48:56markets to trade depending on the type
  2432. 1:48:59of trading system that you want to run
  2433. 1:49:01some commodity markets are much better
  2434. 1:49:04for breakout trading for momentum
  2435. 1:49:07trading and others are much better for
  2436. 1:49:09mean reversion trading for range Trading
  2437. 1:49:12now how can we know which markets are
  2438. 1:49:15better for breakouts which are better
  2439. 1:49:17for mean reversion we have already seen
  2440. 1:49:19a really good clue when we looked at
  2441. 1:49:21that chart with volatility versus
  2442. 1:49:23slippage some markets like Nat gas and
  2443. 1:49:27heating oil gasoline if you are very
  2444. 1:49:29volatile they are going to be great
  2445. 1:49:31markets to build breakout and momentum
  2446. 1:49:34trading systems other markets like cocoa
  2447. 1:49:38feeder cattle rough rice live cattle
  2448. 1:49:40they are more stable they're going to be
  2449. 1:49:43great for mean reversion and range
  2450. 1:49:45trading now there is another great way
  2451. 1:49:48to prove out this concept that some
  2452. 1:49:51markets are great for breakout trading
  2453. 1:49:53some are great for mean reversion
  2454. 1:49:54trading and that is we can test some
  2455. 1:49:57systems we can test breakout systems we
  2456. 1:50:00can test mean reversion systems and we
  2457. 1:50:02can look at the math we can
  2458. 1:50:04quantitatively see in which markets
  2459. 1:50:06should we be breakout trading and in
  2460. 1:50:08which markets should we be mean
  2461. 1:50:10reversion trading to run this analysis
  2462. 1:50:13to see which markets are the best for
  2463. 1:50:16breakout trading or mean reversion
  2464. 1:50:18trading we tested 85 different bar sizes
  2465. 1:50:22from 30 minutes up to daily bars we
  2466. 1:50:24tested the 25 major U.S Futures markets
  2467. 1:50:28and we ran 1500 different optimization
  2468. 1:50:32runs on each of those bar sizes and
  2469. 1:50:35Futures markets that is a total of 3.2
  2470. 1:50:38million optimization tests what were the
  2471. 1:50:41results of testing those simple breakout
  2472. 1:50:44and mean reversion commodity trading
  2473. 1:50:47strategies markets like gasoline sugar
  2474. 1:50:50heating oil and lean Hogs are great for
  2475. 1:50:54breakout trading whereas markets like
  2476. 1:50:56rice coffee live cattle and cocoa are
  2477. 1:51:00better for mean reversion trading and
  2478. 1:51:02very big picture we can also see that
  2479. 1:51:05there are more markets that are breakout
  2480. 1:51:08markets in general commodity markets
  2481. 1:51:11tend to work well for breakout trading
  2482. 1:51:14there are very few markets only a
  2483. 1:51:16handful that are great for mean
  2484. 1:51:18reversion and range trading now this is
  2485. 1:51:21great because we've confirmed both by
  2486. 1:51:23looking at slippage and volatility and
  2487. 1:51:26also by running millions of optimization
  2488. 1:51:29tests that we can see there are
  2489. 1:51:31quantitatively some markets that are
  2490. 1:51:33truly better for breakout trading and
  2491. 1:51:36others that are better for mean
  2492. 1:51:37reversion trading you might say Dave I
  2493. 1:51:40know we've done a lot of strategy
  2494. 1:51:41building and testing in this course but
  2495. 1:51:44remind me what is a breakout strategy
  2496. 1:51:47and what is a mean reversion strategy
  2497. 1:51:49let's quickly look at a breakout
  2498. 1:51:51strategy for the heating oil market and
  2499. 1:51:54a mean reversion strategy for the rice
  2500. 1:51:56Market if we jump into the trade station
  2501. 1:51:59trading platform we can look at a great
  2502. 1:52:02example of a breakout strategy for the
  2503. 1:52:05heating oil Market this trading system
  2504. 1:52:08at its core is buying higher highs and
  2505. 1:52:11it is selling short lower lows it is a
  2506. 1:52:15breakout strategy because it's a
  2507. 1:52:17systematic trading strategy you can add
  2508. 1:52:19it to a heating oil 180 minute bar chart
  2509. 1:52:23we can see how the strategy acts it is
  2510. 1:52:25buying upward momentum selling short
  2511. 1:52:28downward momentum selling short downward
  2512. 1:52:31momentum and this has been a pretty good
  2513. 1:52:34approach to trading heating oil Futures
  2514. 1:52:37this trading system has made about
  2515. 1:52:40221 thousand dollars in profits on a
  2516. 1:52:44single contract of heating oil traded of
  2517. 1:52:47course including the realistic costs of
  2518. 1:52:50slippage and commissions and now let's
  2519. 1:52:52look at a mean reversion system for the
  2520. 1:52:55rice Market what this trading system is
  2521. 1:52:58doing is it is buying lower closes and
  2522. 1:53:02it is selling short higher closes it is
  2523. 1:53:05doing the opposite of our heating oil
  2524. 1:53:07breakout strategy instead of buying
  2525. 1:53:10higher highs it is selling short higher
  2526. 1:53:13highs and again because it's a
  2527. 1:53:15systematic trading strategy we can see
  2528. 1:53:17how this system behaves on a rough rice
  2529. 1:53:21daily bar chart it is selling highs it's
  2530. 1:53:24getting short at higher levels and it is
  2531. 1:53:26buying lows it is buying lower levels
  2532. 1:53:29it's basically mean reversion trading
  2533. 1:53:31and if we look at a strategy performance
  2534. 1:53:33report there we go another nice upward
  2535. 1:53:36sloping Equity curve this trading system
  2536. 1:53:38is made about sixty three thousand
  2537. 1:53:41dollars per single contract of rough
  2538. 1:53:44rice traded since 2010 of course
  2539. 1:53:47including slippage and commission costs
  2540. 1:53:50to wrap up this section let's back up
  2541. 1:53:53and review what we've talked about some
  2542. 1:53:55commodity markets are much better than
  2543. 1:53:58others for trading we can base that
  2544. 1:54:00conclusion on the size of the contract
  2545. 1:54:03the risk of the contract the bang for
  2546. 1:54:06the buck that you get so the volatility
  2547. 1:54:08in terms of slippage that cost to trade
  2548. 1:54:11and some markets are way better for
  2549. 1:54:14breakout trading like Platinum heating
  2550. 1:54:17oil gasoline and some markets are much
  2551. 1:54:19better for mean reversion trading like
  2552. 1:54:22cocoa like that rough rice trading
  2553. 1:54:24system we went through so overall
  2554. 1:54:26hopefully this gives you a structured
  2555. 1:54:29and quantitative way to think about what
  2556. 1:54:32are the best markets for trading in
  2557. 1:54:35terms of slippage contract size risk and
  2558. 1:54:39finally in which markets is it better to
  2559. 1:54:41do breakout or mean reversion Trading
  2560. 1:54:47[Music]
  2561. 1:54:51you've built your trading system you've
  2562. 1:54:54tested entries and exits and filters
  2563. 1:54:56you've optimized the inputs in that
  2564. 1:54:59trading system you have confidence that
  2565. 1:55:01that trading approach can work well
  2566. 1:55:03going forward it is now time to incubate
  2567. 1:55:06your strategy what is incubation
  2568. 1:55:09incubation is seeing how your systematic
  2569. 1:55:12trading approach Works in real time on
  2570. 1:55:16new unseen data it is putting your
  2571. 1:55:18strategy in a drawer putting it aside
  2572. 1:55:20for six months nine months 12 months
  2573. 1:55:23then revisiting it at a later time to
  2574. 1:55:26see how it's done now incubation is easy
  2575. 1:55:29you simply lock in all your inputs you
  2576. 1:55:32don't touch your strategy you don't
  2577. 1:55:34change anything about it and you just
  2578. 1:55:36see how it performs going forward for a
  2579. 1:55:40practical example on an equity curve of
  2580. 1:55:42what this looks like here is a strategy
  2581. 1:55:45that was developed using data from 2010
  2582. 1:55:48until 2018 it was then eval evaluated on
  2583. 1:55:52new data from 2018 to 2020 and then the
  2584. 1:55:56strategy has been incubating since 2020.
  2585. 1:55:59incubation is important because
  2586. 1:56:01everything that you have done up until
  2587. 1:56:04this point up until today is
  2588. 1:56:06optimization it is curve fitting
  2589. 1:56:09changing the inputs in your strategy to
  2590. 1:56:12try and get better performance
  2591. 1:56:14statistics or an even better upward
  2592. 1:56:16sloping Equity curve is optimization
  2593. 1:56:18choosing which filters to use in your
  2594. 1:56:21strategy is optimization walk forward
  2595. 1:56:24analysis even though it does include
  2596. 1:56:27some out-of-sample data is optimization
  2597. 1:56:30even choosing which strategies to run is
  2598. 1:56:33optimization there is no better way to
  2599. 1:56:36avoid those hazards of over optimization
  2600. 1:56:39that are just a natural part of every
  2601. 1:56:41step of a strategy's development process
  2602. 1:56:44than to incubate your strategy and
  2603. 1:56:46believe me I know how frustrating it is
  2604. 1:56:49especially when you're new to systematic
  2605. 1:56:51Trading things you sit on that strategy
  2606. 1:56:53and incubate it or paper traded for
  2607. 1:56:56three months six months nine months 12
  2608. 1:56:58months to get the confidence that it's a
  2609. 1:57:01strategy that could make money in real
  2610. 1:57:03time now the good news about incubation
  2611. 1:57:05is that sometimes the incubation is done
  2612. 1:57:08for you for example if you find a
  2613. 1:57:11trading system from a book that was
  2614. 1:57:13written years ago or you look at one of
  2615. 1:57:15our strategy of the month videos from
  2616. 1:57:17our Peak trading research YouTube
  2617. 1:57:19channel anything that's after that date
  2618. 1:57:22of publication is incubation it is out
  2619. 1:57:25of sample strategy performance and
  2620. 1:57:28incubation is so important that it is
  2621. 1:57:30one of the core principles behind our
  2622. 1:57:33Peak 10 strategy list at Peak algo.com
  2623. 1:57:36every month we share with our clients
  2624. 1:57:39real fully coded systematic trading
  2625. 1:57:42strategies that have been incubating for
  2626. 1:57:45a minimum of six months because again
  2627. 1:57:48real time out of sample performance the
  2628. 1:57:52gold standard by which you should
  2629. 1:57:54evaluate a trading system now how long
  2630. 1:57:57do you need to incubate a strategy
  2631. 1:57:59obviously the longer the better but a
  2632. 1:58:01minimum of six months if you've been
  2633. 1:58:04incubating a strategy for two years
  2634. 1:58:06three years five years that gives you
  2635. 1:58:09the confidence that this strategy has
  2636. 1:58:11real Edge it is not just a fluke that
  2637. 1:58:14that strategy is generating real profits
  2638. 1:58:17so bottom line incubate your trading
  2639. 1:58:20strategies it will save you a lot of
  2640. 1:58:22headaches a lot of heart breaks and it
  2641. 1:58:25will genuinely improve your systematic
  2642. 1:58:27trading performance
  2643. 1:58:30thank you
  2644. 1:58:35we've talked about entries exits filters
  2645. 1:58:39the importance of optimization and
  2646. 1:58:42incubation so at this point you have
  2647. 1:58:44some great strategies that have a good
  2648. 1:58:46chance of making real profits going
  2649. 1:58:49forward and you even know in which
  2650. 1:58:51markets those strategies will likely
  2651. 1:58:53work best how can we put together all of
  2652. 1:58:57those great strategies into a trading
  2653. 1:59:00portfolio after all as we talked about
  2654. 1:59:02in our session on optimization your
  2655. 1:59:05advantage as a systematic Trader is not
  2656. 1:59:09in building the perfect trading system
  2657. 1:59:11but in putting together a portfolio of
  2658. 1:59:14Diversified real-time trading strategies
  2659. 1:59:17so let's now talk about the number one
  2660. 1:59:20tool for analyzing how to put together
  2661. 1:59:23all of your great trading strategies
  2662. 1:59:25into a portfolio and let's talk about
  2663. 1:59:28the very very good news for
  2664. 1:59:30diversification across commodity markets
  2665. 1:59:34why is diversification education so
  2666. 1:59:36important strategy diversification that
  2667. 1:59:40is treating a Ascot of Diversified
  2668. 1:59:42systematic trading strategies all at the
  2669. 1:59:46same time is important because you are
  2670. 1:59:48less exposed to the volatility and the
  2671. 1:59:52drawdowns From Any Given trading system
  2672. 1:59:55we've spent a lot of time in this course
  2673. 1:59:57looking at Equity curves at those nice
  2674. 2:00:00cumulative profit lines that show the
  2675. 2:00:03historical performance of a systematic
  2676. 2:00:06trading strategy and those Equity curves
  2677. 2:00:08are never a straight line there is no
  2678. 2:00:11Perfect Trading System you are always
  2679. 2:00:14going to have some zigs and some zags
  2680. 2:00:16sometimes when the system is in tune
  2681. 2:00:19with the market in times when the system
  2682. 2:00:21is drawing down diversification across
  2683. 2:00:24many different strategies means that you
  2684. 2:00:27can smooth out the cumulative Equity
  2685. 2:00:29curve of your portfolio when you turn on
  2686. 2:00:33five Diversified trading systems 10
  2687. 2:00:36trading systems 15 20 trading systems
  2688. 2:00:39you will obviously find that your
  2689. 2:00:42cumulative profits go up because you're
  2690. 2:00:44taking more Risk by adding more systems
  2691. 2:00:47but your max drawdowns the times when
  2692. 2:00:50you're not making money as a percentage
  2693. 2:00:53of those returns goes down meaning your
  2694. 2:00:56risk adjusted returns go up you are
  2695. 2:01:00getting more bang for the buck and all
  2696. 2:01:02of those popular risk metrics like your
  2697. 2:01:06kalmar ratio return to draw down Arena
  2698. 2:01:09sharp sortino information ratio all of
  2699. 2:01:13those metrics will improve as you add
  2700. 2:01:16more systematic trading strategy to your
  2701. 2:01:19portfolio what is the number one tool
  2702. 2:01:22for analyzing and maximizing the
  2703. 2:01:25diversification benefits of your
  2704. 2:01:28portfolio and assuring that you're
  2705. 2:01:30getting the best risk returns that is a
  2706. 2:01:33simple correlation Matrix a correlation
  2707. 2:01:36Matrix is a great Foundation it's a
  2708. 2:01:40powerful tool for you to do your
  2709. 2:01:42portfolio diversification analysis we
  2710. 2:01:45are going to go through an example of a
  2711. 2:01:47correlation Matrix here if you want
  2712. 2:01:49access to this full spreadsheet you can
  2713. 2:01:52find it in the horse packet at Peak
  2714. 2:01:55algo.com this correlation table shows
  2715. 2:01:58the correlation between different
  2716. 2:02:01systematic trading strategies based on
  2717. 2:02:03weekly returns over the past 10 years in
  2718. 2:02:07this case these strategies happen to be
  2719. 2:02:09from one of our Peak 10 packages from
  2720. 2:02:12Peak algo.com from earlier this year now
  2721. 2:02:16as a reminder the measure of correlation
  2722. 2:02:18runs from negative one to positive one
  2723. 2:02:22anything from 0 to negative one is
  2724. 2:02:25negatively correlated anything from zero
  2725. 2:02:28to positive one is positively correlated
  2726. 2:02:31now as a rule of thumb a correlation
  2727. 2:02:33value from 0 to
  2728. 2:02:360.25 is a weak correlation a correlation
  2729. 2:02:40from a value of 0.25 to 0.75 is a
  2730. 2:02:45moderate correlation and a correlation
  2731. 2:02:48value from
  2732. 2:02:500.7521 is a strong correlation in an
  2733. 2:02:54ideal world you would want your
  2734. 2:02:56correlation table to show a lot of
  2735. 2:02:58negative correlations meaning the
  2736. 2:03:00strategies are all moving in different
  2737. 2:03:03ways so jumping back to our correlation
  2738. 2:03:06table between these different systematic
  2739. 2:03:09trading strategies the first thing we'll
  2740. 2:03:11notice is that we are off to a pretty
  2741. 2:03:14good start we don't see a lot of really
  2742. 2:03:17strong correlations here in this table
  2743. 2:03:20there's not a lot of values that are
  2744. 2:03:23above
  2745. 2:03:250.5.6.7 in fact the highest correlation
  2746. 2:03:28is between two breakout strategies in
  2747. 2:03:31the metal markets the Ducati strategy
  2748. 2:03:33for platinum and the break the Bank
  2749. 2:03:36strategy for silver which are still only
  2750. 2:03:400.29 correlated that's barely a moderate
  2751. 2:03:43correlation and it's interesting to note
  2752. 2:03:45that the Achilles and non-com Trigger
  2753. 2:03:49strategies both of which are trading the
  2754. 2:03:51lean Hogs Market at LH for the
  2755. 2:03:54continuous contract they have a
  2756. 2:03:56correlation of only
  2757. 2:03:590.09 a very weak correlation right
  2758. 2:04:02around zero this correlation Matrix
  2759. 2:04:05tells us that this is a great basket of
  2760. 2:04:08strategies to trade together our
  2761. 2:04:10correlation Matrix tells us that there
  2762. 2:04:13are not a lot of positively correlated
  2763. 2:04:15strategies which means we are getting a
  2764. 2:04:18lot of diversification benefits from
  2765. 2:04:20Trading all these strategies together
  2766. 2:04:22now this points to one of the biggest
  2767. 2:04:25advantages of systematic trading across
  2768. 2:04:28commodity markets specifically if we
  2769. 2:04:31look at the way that commodity markets
  2770. 2:04:33move the price action across different
  2771. 2:04:36commodity markets will see that they are
  2772. 2:04:39not that correlated the wheat Market
  2773. 2:04:41moves in a very different way than bean
  2774. 2:04:44oil which moves in a very different way
  2775. 2:04:46than coffee than lean Hogs than gasoline
  2776. 2:04:49these markets are all very unique and
  2777. 2:04:52respond to a different mix of
  2778. 2:04:54fundamental and non-fundamental price
  2779. 2:04:57drivers I'll layer on top of that that
  2780. 2:04:59not only do these markets move in very
  2781. 2:05:02different ways but we are trading
  2782. 2:05:04different systems looking at different
  2783. 2:05:07bar sizes different time frames so it
  2784. 2:05:10just makes sense that all of these
  2785. 2:05:13trading systems will naturally move in
  2786. 2:05:15very different ways and that is not the
  2787. 2:05:18case across all markets for example if
  2788. 2:05:21you were only trading stock markets or
  2789. 2:05:24you were only trading interest rates or
  2790. 2:05:26foreign exchange markets stock markets
  2791. 2:05:29are way more correlated to one another
  2792. 2:05:31for example S P 500 the Russell 2000 the
  2793. 2:05:35dial the Nasdaq all tend to move
  2794. 2:05:38together currency markets generally tend
  2795. 2:05:41to move together tend to follow the same
  2796. 2:05:43macro themes or broad Trends in the US
  2797. 2:05:46dollar that is not the case with
  2798. 2:05:48commodity markets and it is a huge
  2799. 2:05:51Advantage for you as a systematic Trader
  2800. 2:05:54this means that if you are trading
  2801. 2:05:56commodity markets diversification is
  2802. 2:05:59naturally on your side and my strong
  2803. 2:06:02opinion here is that it is great to put
  2804. 2:06:05together a correlation Matrix and get a
  2805. 2:06:07sense that your strategies will be
  2806. 2:06:09Diversified and move in different ways
  2807. 2:06:12but don't feel that you need to go much
  2808. 2:06:15beyond that that you need to complicate
  2809. 2:06:17things too much in terms of your
  2810. 2:06:19diversification and risk analysis your
  2811. 2:06:22time is much better spent testing
  2812. 2:06:25strategies incubating strategies versus
  2813. 2:06:28obsessing over all the minute
  2814. 2:06:30differences and correlations between
  2815. 2:06:32your different already Diversified
  2816. 2:06:34strategy again this is a huge advantage
  2817. 2:06:38of commodity markets is that if you are
  2818. 2:06:40trading a number of different systems
  2819. 2:06:43especially if they're across different
  2820. 2:06:45markets diversification is naturally
  2821. 2:06:47already on your side bottom line
  2822. 2:06:50diversification is important because it
  2823. 2:06:53helps the overall risk return profile of
  2824. 2:06:57your portfolio a simple correlation
  2825. 2:07:00Matrix the kind you can find in the
  2826. 2:07:02course packet at Peak algo.com is your
  2827. 2:07:05number one tool for assessing the
  2828. 2:07:08diversification benefits of your
  2829. 2:07:10portfolio and finally if you are trading
  2830. 2:07:13commodity markets you are in a very very
  2831. 2:07:16good place because there are massive
  2832. 2:07:19diversification benefits between your
  2833. 2:07:22different trading systems we've now
  2834. 2:07:24finished our section on optimization
  2835. 2:07:27incubation and portfolio construction it
  2836. 2:07:30is now time to get started with live
  2837. 2:07:33trading in terms of our system attic
  2838. 2:07:36strategy development process we are here
  2839. 2:07:39we are at the top of the mountain the
  2840. 2:07:42top of the strategy development pyramid
  2841. 2:07:44so let's move on to our next and final
  2842. 2:07:46section let's get started
  2843. 2:07:50foreign
  2844. 2:07:51[Music]
  2845. 2:07:55this is the big moment you've built your
  2846. 2:07:59trading system you've tested it you've
  2847. 2:08:01done some gentle optimization maybe
  2848. 2:08:03added some filters you're comfortable
  2849. 2:08:05with the risk of the strategy you've
  2850. 2:08:08incubated this strategy to see how it
  2851. 2:08:11performs in real time on new unseen data
  2852. 2:08:14and you know how this strategy fits into
  2853. 2:08:17your overall portfolio you are now ready
  2854. 2:08:19to pull the trigger and automate your
  2855. 2:08:22trading system so that your automated
  2856. 2:08:24trading platform will execute trades in
  2857. 2:08:28the market on your behalf now this is a
  2858. 2:08:31big step in fact it's the biggest step
  2859. 2:08:34because it's the moment that you
  2860. 2:08:36transition from building and testing
  2861. 2:08:38strategies into becoming a true
  2862. 2:08:41algorithmic Trader the good news is that
  2863. 2:08:43this big step of automating your trading
  2864. 2:08:47systems is actually very straightforward
  2865. 2:08:49regardless of the automated trading
  2866. 2:08:52platform that you're using the
  2867. 2:08:54automation process entails three simple
  2868. 2:08:57Steps step number one is ensuring that
  2869. 2:09:01you are set up to trade the correct
  2870. 2:09:04Futures Contract step number two is
  2871. 2:09:07pressing the automate button step number
  2872. 2:09:09three is confirming that the position
  2873. 2:09:12you hold in the market matches your
  2874. 2:09:15systematic strategy position step number
  2875. 2:09:18three includes rolling your Futures
  2876. 2:09:21Contract through time to ensure that you
  2877. 2:09:24are always trading the correct Futures
  2878. 2:09:26Contract let's start by looking at
  2879. 2:09:29practical examples of what this
  2880. 2:09:31automation process looks like now I'll
  2881. 2:09:34be walking through these examples in the
  2882. 2:09:36tradestation trading platform but
  2883. 2:09:39remember that this automation process of
  2884. 2:09:42mapping the correct contract pressing
  2885. 2:09:44the automate button and confirming that
  2886. 2:09:47your Market position matches your system
  2887. 2:09:49position is the same automation process
  2888. 2:09:52regardless of the trading platform form
  2889. 2:09:55that you use to keep things simple this
  2890. 2:09:58is what tradestation looks like right
  2891. 2:10:00out of the box so if you've never used
  2892. 2:10:03tradestation or another automated
  2893. 2:10:05trading platform this is what it looks
  2894. 2:10:07like when you first open up the platform
  2895. 2:10:10the first thing that we're going to do
  2896. 2:10:12is we are going to open up a chart trade
  2897. 2:10:16station like most other automated
  2898. 2:10:18trading platforms is a chart-based
  2899. 2:10:22trading platform in this case we are
  2900. 2:10:24going to open up a chart for orange
  2901. 2:10:27juice
  2902. 2:10:29180 minute bars let's start with January
  2903. 2:10:331st 2010 exchange time 180 minute bars
  2904. 2:10:37on orange juice and there is our chart
  2905. 2:10:39now for the next step we are going to
  2906. 2:10:43add a strategy to this chart we're going
  2907. 2:10:46to add an orange juice trading strategy
  2908. 2:10:49to our orange juice 180 minute bar chart
  2909. 2:10:53so to start let's jump into trade
  2910. 2:10:56station development environment and
  2911. 2:10:58let's open up a new strategy that we are
  2912. 2:11:02just going to name dueling orange juice
  2913. 2:11:06now we can get rid of this demo text and
  2914. 2:11:10we can paste in the strategy code for
  2915. 2:11:14our dueling momentum strategy for the
  2916. 2:11:17orange juice Market we can now add our
  2917. 2:11:20dueling orange juice strategy to our
  2918. 2:11:23chart to add strategy there's our
  2919. 2:11:26dueling orange juice strategy press OK
  2920. 2:11:29and our systematic trading strategy for
  2921. 2:11:33the orange juice Market has now been
  2922. 2:11:35added to our orange juice chart if we
  2923. 2:11:39look at a strategy performance report we
  2924. 2:11:41should see a nice upward sloping Equity
  2925. 2:11:44curve for this dueling momentum strategy
  2926. 2:11:46for the orange juice market now of
  2927. 2:11:49course importantly we need to take that
  2928. 2:11:51step of ensuring that this is a
  2929. 2:11:53realistic strategy and add
  2930. 2:11:55costs of slippage and commissions enable
  2931. 2:11:59look inside bar testing and let's double
  2932. 2:12:01check this strategy still looks okay
  2933. 2:12:03when we include those costs still works
  2934. 2:12:07still a good strategy for the orange
  2935. 2:12:09juice Market including those realistic
  2936. 2:12:12costs of slippage and commissions so we
  2937. 2:12:15have now brought up an orange juice
  2938. 2:12:17chart we have added our dueling momentum
  2939. 2:12:20strategy to that orange juice chart to
  2940. 2:12:24automate this strategy we need to follow
  2941. 2:12:26that first important step of ensuring
  2942. 2:12:29that we're set up to trade the correct
  2943. 2:12:31orange juice contract now remember that
  2944. 2:12:34all of the strategy building and testing
  2945. 2:12:37that we have done in this course so far
  2946. 2:12:39is always on the continuous contract
  2947. 2:12:43what is a continuous contract as a
  2948. 2:12:46reminder continuous contract for any
  2949. 2:12:49commodity Futures Market is just the
  2950. 2:12:52knit together history of all the futures
  2951. 2:12:55contracts that have come before but it
  2952. 2:12:58is not a real Futures Contract remember
  2953. 2:13:01that commodity contracts are always
  2954. 2:13:04expiring they only last for a limited
  2955. 2:13:07period of time maybe a year or two years
  2956. 2:13:10by using a continuous contract we can do
  2957. 2:13:14long-term historical analysis and
  2958. 2:13:17strategy building to automate our orange
  2959. 2:13:20juice trading system we simply need to
  2960. 2:13:23adjust our chart to not reference The
  2961. 2:13:26Continuous orange juice contract but
  2962. 2:13:28rather the active front month orange
  2963. 2:13:31juice contract to add the active orange
  2964. 2:13:34juice contract to our chart I'm going to
  2965. 2:13:38follow two different steps first I'm
  2966. 2:13:42going to add the continuous contract as
  2967. 2:13:46a second security so we can see it on
  2968. 2:13:50our chart there we go there is the
  2969. 2:13:52continuous contract for orange juice
  2970. 2:13:54with the same price this is the
  2971. 2:13:56continuous contract above I am then
  2972. 2:13:59going to amend that first security so
  2973. 2:14:03that instead of being the continuous
  2974. 2:14:05contract it is the continuous July
  2975. 2:14:09contract now I have a choice here I can
  2976. 2:14:11either use the continuous July contract
  2977. 2:14:14with lots of History going back through
  2978. 2:14:16time or I could simply use the front
  2979. 2:14:19orange juice July contract in this case
  2980. 2:14:22I would only be able to see my strategy
  2981. 2:14:24performance for as long as this July
  2982. 2:14:27contract has been around so I'm going to
  2983. 2:14:30choose to use the continuous front
  2984. 2:14:32orange juice July contract we are now
  2985. 2:14:35good to go we have our continuous July
  2986. 2:14:39orange juice contract loaded on top we
  2987. 2:14:42have our continuous contract for orange
  2988. 2:14:45juice loaded on the bottom here and
  2989. 2:14:47importantly those prices are the same
  2990. 2:14:51this tells me that we are correctly
  2991. 2:14:53using the July contract to trade it
  2992. 2:14:57matches the price for the continuous
  2993. 2:14:59contract that we have used for all of
  2994. 2:15:01our strategy building and testing and
  2995. 2:15:04again as a good double check I can see
  2996. 2:15:07there is the same Equity curve for this
  2997. 2:15:10strategy we have now completed that
  2998. 2:15:13first important step of ensuring that we
  2999. 2:15:16are set up to trade the correct front
  3000. 2:15:19month Futures Contract in the orange
  3001. 2:15:21juice Market let's move on to step two
  3002. 2:15:24which is pressing the automate button
  3003. 2:15:27now we'll be looking at this automation
  3004. 2:15:29process for the tradestation trading
  3005. 2:15:32platform but again it's the same process
  3006. 2:15:35regardless of the trading platform that
  3007. 2:15:38you're using once you have your price
  3008. 2:15:40chart once you have your system loaded
  3009. 2:15:43on that chart and once you have the
  3010. 2:15:45correct contract mapped on that chart it
  3011. 2:15:49is always very straightforward in how
  3012. 2:15:52you can take that next step to automate
  3013. 2:15:54your trading system system regardless of
  3014. 2:15:57the platform you're using let's jump
  3015. 2:15:59back into tradestation and take that big
  3016. 2:16:03step let's automate this trading system
  3017. 2:16:06for the orange juice Market I'm simply
  3018. 2:16:09going to go down to the automation
  3019. 2:16:11section here generate strategy orders
  3020. 2:16:14check it and I want to automate
  3021. 2:16:16execution using my account with account
  3022. 2:16:20confirmation off meaning I don't want
  3023. 2:16:23tradestation to ask me every time I want
  3024. 2:16:26to execute orders I want tradestation to
  3025. 2:16:29execute orders automatically without
  3026. 2:16:32confirmation on my behalf I press OK we
  3027. 2:16:36are up and running this is now a fully
  3028. 2:16:39automated systematic trading strategy
  3029. 2:16:42for the orange juice Market we have now
  3030. 2:16:45taken that big step we've automated our
  3031. 2:16:48orange juice trading system we are
  3032. 2:16:51systematic trading let's now move on to
  3033. 2:16:54step three and confirm that our Market
  3034. 2:16:58position matches our strategy position
  3035. 2:17:01and this is going to be easy in this
  3036. 2:17:03example because when we automated this
  3037. 2:17:06trading system it didn't happen to have
  3038. 2:17:08an open position that should be in the
  3039. 2:17:10market jumping back to our orange juice
  3040. 2:17:13chart in tradestation if we zoom in on
  3041. 2:17:17the chart we can see that this system
  3042. 2:17:19doesn't currently have a position the
  3043. 2:17:22system last went long at the beginning
  3044. 2:17:24of the month got stopped out last week
  3045. 2:17:27and hasn't yet gone long or short orange
  3046. 2:17:30juice Futures now if we jump into a
  3047. 2:17:35trade manager in trade station this is
  3048. 2:17:38what we're looking for we can see that
  3049. 2:17:40our positions match our strategy tells
  3050. 2:17:43us to be flat and our open position in
  3051. 2:17:46the market what we actually hold in our
  3052. 2:17:49brokerage account is also flat meaning
  3053. 2:17:51those positions match but what if that
  3054. 2:17:54were not the case what if we had turned
  3055. 2:17:57on our systematic trading strategy
  3056. 2:18:00knowing that the system had either a
  3057. 2:18:03long or short position in the market
  3058. 2:18:05that we would have to trade to match
  3059. 2:18:08let's jump into tradestation and look at
  3060. 2:18:10a second example of turning on a system
  3061. 2:18:13where there is currently an active
  3062. 2:18:16position there's a silver 360 minute bar
  3063. 2:18:21chart this is a breakout strategy for
  3064. 2:18:24the silver market if we look at a
  3065. 2:18:26strategy performance report we can see
  3066. 2:18:29that this strategy has performed
  3067. 2:18:31relatively well over the past decade
  3068. 2:18:33including the realistic costs of
  3069. 2:18:36slippage and commissions and importantly
  3070. 2:18:39if we jump into the chart and zoom in we
  3071. 2:18:42can see that this system currently has a
  3072. 2:18:46short position in silver Futures the
  3073. 2:18:48system sold this brake lower just last
  3074. 2:18:52weekend holds that short position today
  3075. 2:18:55I've now now added the continuous silver
  3076. 2:18:58contract to this chart I've changed this
  3077. 2:19:01contract one the tradable contract to
  3078. 2:19:04The Continuous July contract so we'll be
  3079. 2:19:07trading July silver Futures confirmed
  3080. 2:19:10that our strategy performance report
  3081. 2:19:13still looks good nice upward sloping
  3082. 2:19:16Equity curve we are ready to again
  3083. 2:19:19automate a strategy go down to strategy
  3084. 2:19:22automation automate executing this
  3085. 2:19:25account I agree with account
  3086. 2:19:27confirmation off we are again
  3087. 2:19:30automatically trading silver Futures in
  3088. 2:19:33the market now using this approach we
  3089. 2:19:36have now automated this trading system
  3090. 2:19:39on July silver Futures but we know that
  3091. 2:19:43the strategy has a short position but we
  3092. 2:19:46don't yet have a short position in the
  3093. 2:19:50brokerage account there it is our
  3094. 2:19:52strategy position is short one contract
  3095. 2:19:55Act of July silver Futures but our open
  3096. 2:19:58position is flat so to amend this to fix
  3097. 2:20:02this we can simply sell one contract of
  3098. 2:20:06July silver Futures at Market there is a
  3099. 2:20:10quick trade bar for July silver Futures
  3100. 2:20:13and we are going to sell one contract at
  3101. 2:20:17market and the nice thing about selling
  3102. 2:20:19that contract is that we have our
  3103. 2:20:22positions now match strategy position
  3104. 2:20:25short one open position short one we are
  3105. 2:20:29matched and if you'd like a deeper dive
  3106. 2:20:31into creating the perfect tradestation
  3107. 2:20:33desktop for monitoring your positions
  3108. 2:20:36and profits you can click our link here
  3109. 2:20:39for the perfect tradestation setup we've
  3110. 2:20:42now gone through two examples both the
  3111. 2:20:44orange juice trading system that didn't
  3112. 2:20:47currently have a position and the silver
  3113. 2:20:49trading system that did have a short
  3114. 2:20:52silver Futures position that both show
  3115. 2:20:55us that pulling the trigger automating
  3116. 2:20:58these trading strategies is actually
  3117. 2:21:01relatively straightforward and after we
  3118. 2:21:03have automated our trading system and
  3119. 2:21:06made sure that our strategy position
  3120. 2:21:09matches our Market position all we have
  3121. 2:21:12to do going forward is make sure that
  3122. 2:21:14our strategy position continues to match
  3123. 2:21:18our Market position and that includes
  3124. 2:21:21rolling contracts through time as a
  3125. 2:21:24different future contracts expire what
  3126. 2:21:27does a contract expiring and a contract
  3127. 2:21:30role look like in tradestation at some
  3128. 2:21:34point in the future this orange juice
  3129. 2:21:36continuous contract price will start to
  3130. 2:21:39reflect September Futures price not the
  3131. 2:21:43July Futures price because the July
  3132. 2:21:45contract will start to lose trading
  3133. 2:21:47volume and it will go off the board
  3134. 2:21:50meaning it's just going to expire and
  3135. 2:21:52lose volume September will become the
  3136. 2:21:55more active contract and at that point
  3137. 2:21:58we will see these prices become
  3138. 2:22:02different so this 250 and 250 suddenly
  3139. 2:22:05The Continuous contract will be a
  3140. 2:22:07different price because it's referencing
  3141. 2:22:09a different new contract it will start
  3142. 2:22:11referencing the September price now the
  3143. 2:22:14good news is is that because we don't
  3144. 2:22:16currently have a position in orange
  3145. 2:22:19juice if we were to see that change
  3146. 2:22:22occur today we would simply amend the
  3147. 2:22:26front contract to be the September
  3148. 2:22:29contract instead of the July contract
  3149. 2:22:31which is just as easy as changing this
  3150. 2:22:34to a u instead of an n and if you need
  3151. 2:22:37to roll a contract for a system where
  3152. 2:22:40you do have a market position for
  3153. 2:22:43example that silver trading system that
  3154. 2:22:46we automated it's not that much more
  3155. 2:22:49complicated you simply need to change
  3156. 2:22:51the contract on your chart to reflect
  3157. 2:22:54the new active contracts so it matches
  3158. 2:22:57the continuous contract price and you'll
  3159. 2:23:00need to roll the actual position that
  3160. 2:23:03you have in the market to match your
  3161. 2:23:06trading system so if you are short one
  3162. 2:23:09contract of July silver Futures you're
  3163. 2:23:12going to have to buy back that short to
  3164. 2:23:14cover that short July position and sell
  3165. 2:23:18one contract of September silver Futures
  3166. 2:23:21this may sound a little bit complicated
  3167. 2:23:24but just think about it as migrating
  3168. 2:23:26both your chart and your position from
  3169. 2:23:29an old contract to a new contract now
  3170. 2:23:33this is one of the most frustrating
  3171. 2:23:35parts of systematic trading for
  3172. 2:23:38commodity Futures specifically remember
  3173. 2:23:41stocks don't have contract rules ETFs
  3174. 2:23:45and cryptos don't have contract roles
  3175. 2:23:47but this is just a part of Futures
  3176. 2:23:50Trading at least for now there is no
  3177. 2:23:53liquid tradable continuous contract you
  3178. 2:23:56will have to roll your contracts Through
  3179. 2:23:58Time both in terms of your chart where
  3180. 2:24:01your system is automated and in terms of
  3181. 2:24:04the actual Futures positions that you
  3182. 2:24:07hold in your account to wrap up this
  3183. 2:24:10session it is a big step and a big deal
  3184. 2:24:13to press that automate button it
  3185. 2:24:16represents not only a huge investment in
  3186. 2:24:19your education and your career but you
  3187. 2:24:22are now a systematic Trader and that is
  3188. 2:24:25something to celebrate you are deploying
  3189. 2:24:28real Capital using real Futures
  3190. 2:24:31contracts using an evidence-based
  3191. 2:24:33systematic approach to trade
  3192. 2:24:38foreign
  3193. 2:24:39[Music]
  3194. 2:24:44we've talked about building strategies
  3195. 2:24:46testing strategies incubating strategies
  3196. 2:24:50so that they have the best chance of
  3197. 2:24:52Performing well and generating profits
  3198. 2:24:54in real time but that said strategies
  3199. 2:24:57can underperform and strategies can
  3200. 2:25:00break experiencing drawdowns and going
  3201. 2:25:03through periods when you're losing money
  3202. 2:25:05instead of making money is unfortunately
  3203. 2:25:08just a realistic part of systematic
  3204. 2:25:11trading the good news is that if you
  3205. 2:25:14anticipate these drawdowns and you have
  3206. 2:25:16a game plan in place for what to do when
  3207. 2:25:19those drawdowns occur it will help your
  3208. 2:25:22confidence it will help you stay in the
  3209. 2:25:24game and ultimately it will help your
  3210. 2:25:27long-term profitability so when should
  3211. 2:25:30you turn off a trading system when is it
  3212. 2:25:34time to quit in this session we'll talk
  3213. 2:25:36about the three steps that you can take
  3214. 2:25:38to best anticipate and manage drawdowns
  3215. 2:25:42when they inevitate occur why do
  3216. 2:25:45strategies break strategies can break
  3217. 2:25:47for a lot of different reasons markets
  3218. 2:25:50change all the time market dynamics
  3219. 2:25:53change around liquidity and trading
  3220. 2:25:56volumes market conditions change around
  3221. 2:25:58supply and demand and Market
  3222. 2:26:00participants change for example in
  3223. 2:26:03agriculture markets in just the last 10
  3224. 2:26:06years we've seen new government biofuel
  3225. 2:26:09mandates we've seen Brazil come online
  3226. 2:26:11as a massive producer of soybeans and
  3227. 2:26:15corn and sugar China is now an
  3228. 2:26:17incredibly important importer of
  3229. 2:26:19agriculture products and there's now
  3230. 2:26:22more money than ever before in
  3231. 2:26:24quantitative strategies that trade these
  3232. 2:26:27markets so a lot has changed across all
  3233. 2:26:30markets and that definitely applies to
  3234. 2:26:32commodity markets as well so a trading
  3235. 2:26:35approach that worked 20 years ago 15
  3236. 2:26:38years ago 10 years ago may not be as
  3237. 2:26:41relevant it may not work as well to
  3238. 2:26:43today and another reason that a strategy
  3239. 2:26:46might break is just because it's over
  3240. 2:26:48optimized all of this strategy inputs
  3241. 2:26:51and variables and filters are so
  3242. 2:26:53specifically tuned to a backward looking
  3243. 2:26:56historical period that it effectively
  3244. 2:26:59guarantees that the strategy will not
  3245. 2:27:01work as well going forward now we've
  3246. 2:27:04talked a lot in this course about the
  3247. 2:27:06importance of incubation so hopefully
  3248. 2:27:08you can avoid some of the pitfalls of
  3249. 2:27:11over optimization but still there is a
  3250. 2:27:14chance that even a well-built strategy
  3251. 2:27:17and incubated strategy can break in real
  3252. 2:27:20time now what does a strategy breaking
  3253. 2:27:23look like let's look at an example from
  3254. 2:27:26stock markets in this case this is a
  3255. 2:27:29strategy that trades S P 500 futures
  3256. 2:27:33based on a few simple criteria if S P
  3257. 2:27:37500 futures are above the long-term
  3258. 2:27:40moving average so if we're still in a
  3259. 2:27:41bull market but short-term momentum is
  3260. 2:27:44defined by RSI and defined by being
  3261. 2:27:47below this shorter term moving average
  3262. 2:27:49is pointing down then the system will
  3263. 2:27:52buy and the system will exit when
  3264. 2:27:54momentum recovers so again long-term
  3265. 2:27:56bull market short-term momentum is
  3266. 2:27:58pointing lower the system buys and the
  3267. 2:28:00system then exits when momentum recovers
  3268. 2:28:03if we look at a chart we can see how
  3269. 2:28:06this system trades it is buying dips so
  3270. 2:28:09it is buying dips whenever the stock
  3271. 2:28:12market dips whenever RSI is low whenever
  3272. 2:28:15we're below some short-term moving
  3273. 2:28:16averages the system buys and then exits
  3274. 2:28:19once momentum has recovered and if we
  3275. 2:28:22look at a strategy performance report we
  3276. 2:28:25see an incredible Equity curve a
  3277. 2:28:28beautiful upward sloping Equity curve on
  3278. 2:28:31S P 500 futures for the period from 2009
  3279. 2:28:35to
  3280. 2:28:362017. Performance summary an
  3281. 2:28:39unbelievable percent profitable 86
  3282. 2:28:41percent profitable so this strategy was
  3283. 2:28:44performing exceptionally well through
  3284. 2:28:47the end of 2017 but what if we extend
  3285. 2:28:51the analysis past the end of 2017. what
  3286. 2:28:55if we bring it out to today we can see
  3287. 2:28:59that pretty much immediately after 2017
  3288. 2:29:02right at the beginning of 2018 there was
  3289. 2:29:05actually an event in the market called
  3290. 2:29:07volmageddon there were a lot of traders
  3291. 2:29:09that were buying dips that were selling
  3292. 2:29:12volatility a lot of short volatility
  3293. 2:29:15ETFs got blown up and this strategy
  3294. 2:29:18began to underperform and has never
  3295. 2:29:21really recovered since there are a few
  3296. 2:29:24reasons that I think this is the perfect
  3297. 2:29:26example of a strategy breaking first of
  3298. 2:29:29all this was a very popular trading
  3299. 2:29:31approach in 2016 and 2017 there were a
  3300. 2:29:35lot of hedge funds a lot of momentum
  3301. 2:29:37ctas that were trading some version of
  3302. 2:29:40this buy the dip RSI s p trading
  3303. 2:29:43strategy second of all this strategy was
  3304. 2:29:46probably over optimized if you look at a
  3305. 2:29:49lot of those inputs they're using very
  3306. 2:29:51specific values which suggest that they
  3307. 2:29:54are optimized to a historical period
  3308. 2:29:57from 2010 to 2016 or 17 and don't really
  3309. 2:30:00reflect what could happen going forward
  3310. 2:30:03and finally something just changed in
  3311. 2:30:06the market that uptrend with free money
  3312. 2:30:08with quantitative easing came to an end
  3313. 2:30:11volatility came back to the market and
  3314. 2:30:14just absolutely wrecked this system but
  3315. 2:30:16it is a great example of a strategy
  3316. 2:30:19breaking of a strategy that was doing
  3317. 2:30:21exceptionally well for a small period of
  3318. 2:30:24time but then just absolutely falling
  3319. 2:30:27apart once the market changed what are
  3320. 2:30:29the three steps that you can take to
  3321. 2:30:32best anticipate and manage strategy
  3322. 2:30:35drawdowns number one is expect that
  3323. 2:30:39drawdowns will happen remember your
  3324. 2:30:42maximum drawdown down is always ahead of
  3325. 2:30:45you there is going to be a point in the
  3326. 2:30:47future where your strategy underperforms
  3327. 2:30:49and there might even be a point where
  3328. 2:30:51that strategy stops working all together
  3329. 2:30:54you should be very pragmatic about the
  3330. 2:30:56strategies that you trade you should not
  3331. 2:30:59fall in love with any given trading
  3332. 2:31:01system remember there is no Perfect
  3333. 2:31:04Trading strategy and from my own
  3334. 2:31:06personal experience the more that I fall
  3335. 2:31:09in love with this strategy the more that
  3336. 2:31:11I'm convinced that this is a strategy
  3337. 2:31:13that will make me money forever the
  3338. 2:31:16higher the probability that it will
  3339. 2:31:18underperform going forward think of your
  3340. 2:31:21strategies as tools for extracting money
  3341. 2:31:25from the market if that tool stops
  3342. 2:31:27working stop using that tool expect and
  3343. 2:31:31anticipate that drawdowns will happen
  3344. 2:31:33number two have a predefined approach
  3345. 2:31:36and a predefined threshold where you
  3346. 2:31:39will turn off an underperforming
  3347. 2:31:42strategy don't don't wait until a
  3348. 2:31:44strategy is losing money to make that
  3349. 2:31:46decision and make sure that you can
  3350. 2:31:48apply that threshold to every strategy
  3351. 2:31:51that you trade for example you do not
  3352. 2:31:54want to say well I'll turn off any of my
  3353. 2:31:56trading strategies if they lose two
  3354. 2:31:58thousand dollars because maybe you have
  3355. 2:32:00strategies that trade different size
  3356. 2:32:03contracts or strategies that have a
  3357. 2:32:05different percentage success rate or
  3358. 2:32:08strategies that trade more often than
  3359. 2:32:10others come up with a generalized
  3360. 2:32:12approach that you can apply to all of
  3361. 2:32:15your trading strategies it will make
  3362. 2:32:17your life a lot easier the best approach
  3363. 2:32:20here that you can apply to all of your
  3364. 2:32:22trading systems is to look at historical
  3365. 2:32:25drawdowns when you build a systematic
  3366. 2:32:28trading strategy when you're testing a
  3367. 2:32:31systematic trading strategy you have
  3368. 2:32:33that nice historical Equity curve you
  3369. 2:32:36can look at historical strategy
  3370. 2:32:38performance so you can always look at
  3371. 2:32:40the maximum drawdown the worst period of
  3372. 2:32:43under performance for that strategy
  3373. 2:32:46historically so a great threshold for
  3374. 2:32:49deciding when to turn off a systematic
  3375. 2:32:52trading strategy is to use 100 of
  3376. 2:32:55historical Max drawdown basically if the
  3377. 2:32:58worst drawdown that your system has ever
  3378. 2:33:01had historically is eight thousand
  3379. 2:33:03dollars per contract and you are
  3380. 2:33:05currently at a loss of eight thousand
  3381. 2:33:07dollars per contract that is a good time
  3382. 2:33:10to turn off that system let's look at an
  3383. 2:33:13example of this idea of a hundred
  3384. 2:33:15percent max historical drawdown if we
  3385. 2:33:18look at a performance report for a live
  3386. 2:33:22cattle 135 minute bar strategy there's a
  3387. 2:33:26nice upward sloping Equity curve but
  3388. 2:33:29this strategy has had a bit of a
  3389. 2:33:31drawdown recently we had a bad trade
  3390. 2:33:34just a few weeks ago we had uh what
  3391. 2:33:36looks like a stop loss and that stop
  3392. 2:33:38loss had a trade loss of about three
  3393. 2:33:41thousand three hundred dollars per
  3394. 2:33:43contract so that means we're seeing a
  3395. 2:33:45bit of a dent in that upward sloping
  3396. 2:33:48Equity curve now if we look at a
  3397. 2:33:50performance summary we can see that the
  3398. 2:33:53max drawdown for this system intraday
  3399. 2:33:55Peak to Valley was twelve thousand
  3400. 2:33:57dollar closed to close for a trade was
  3401. 2:34:00about eleven thousand dollars and if we
  3402. 2:34:02look at a chart we can see where that
  3403. 2:34:03occurred that occurred right here so the
  3404. 2:34:06current drawdown of three thousand
  3405. 2:34:08dollars is a small fraction of the max
  3406. 2:34:11historical drawdown of ten thousand
  3407. 2:34:14dollars so if we were to use that
  3408. 2:34:16hundred percent max historical drawdown
  3409. 2:34:18as a threshold for turning off this
  3410. 2:34:21system we would still have some room
  3411. 2:34:23here we'd be about a third of the way to
  3412. 2:34:25that Max historical drawdown we could
  3413. 2:34:27have two more bad trades that would lose
  3414. 2:34:29three thousand dollars before we'd get
  3415. 2:34:31close to that threshold now why use a
  3416. 2:34:34hundred percent of Maximum historical
  3417. 2:34:36drawdown why not use 75 or 50 the reason
  3418. 2:34:40for that is you want your Thresh told to
  3419. 2:34:43be wide enough so that you give an
  3420. 2:34:45underperforming strategy enough room to
  3421. 2:34:48recover but you also want to recognize
  3422. 2:34:51that maybe that strategy is broken you
  3423. 2:34:53want a threshold that's realistic so
  3424. 2:34:55that you're not losing a hundred percent
  3425. 2:34:58150 percent 200 of your max historical
  3426. 2:35:02drawdown and most importantly find a
  3427. 2:35:04threshold that you are comfortable with
  3428. 2:35:06maybe because of your portfolio size or
  3429. 2:35:09your risk tolerance or the systems that
  3430. 2:35:12you're running maybe you want to use 50
  3431. 2:35:14of Max historical drawdown as your
  3432. 2:35:17threshold and risk that you'll turn off
  3433. 2:35:19systems too early that might recover
  3434. 2:35:22later that is up to you the most
  3435. 2:35:24important concept here is that that
  3436. 2:35:27threshold is a red line just as we've
  3437. 2:35:30spent this whole course talking about
  3438. 2:35:32the importance of automating our
  3439. 2:35:34systematic trading strategies we need to
  3440. 2:35:37recognize the importance of automating
  3441. 2:35:39our portfolio management and automating
  3442. 2:35:42the decision process around turning off
  3443. 2:35:45underperforming strategies have that
  3444. 2:35:48game plan in place stick to it turn off
  3445. 2:35:51that system when it gets past whatever
  3446. 2:35:53threshold you've established the number
  3447. 2:35:56three step for properly anticipating and
  3448. 2:35:59managing drawdowns and turning off
  3449. 2:36:01underperforming trading systems have a
  3450. 2:36:04deep bench have lots of systematic
  3451. 2:36:07trading strategies waiting to be traded
  3452. 2:36:10strategies that are incubating that are
  3453. 2:36:12paper trading that are performing well
  3454. 2:36:14in real time and that can replace any
  3455. 2:36:18underperforming strategies that are
  3456. 2:36:20currently in your portfolio now this is
  3457. 2:36:23the number one question that I get in my
  3458. 2:36:26inbox every single week how to best
  3459. 2:36:29rotate strategies how to replace
  3460. 2:36:32underperforming strategies with
  3461. 2:36:34strategies that are more in tune with
  3462. 2:36:36the current market and because I'm a
  3463. 2:36:39huge soccer fan and I played soccer at
  3464. 2:36:41University I always bring up the example
  3465. 2:36:44of Premier League football English
  3466. 2:36:47Premier League football like a lot of
  3467. 2:36:49other European football leagues
  3468. 2:36:52comprises 20 different teams these are
  3469. 2:36:55the best 20 teams in England but that
  3470. 2:36:58top 20 list is always changing every
  3471. 2:37:01year the bottom three teams in the
  3472. 2:37:04Premier League are relegated they're
  3473. 2:37:07basically demoted down to the next
  3474. 2:37:09League the championship league and the
  3475. 2:37:12top three teams from the championship
  3476. 2:37:14get promoted up to Premier League
  3477. 2:37:17football now I'm sure you can see where
  3478. 2:37:19I'm going with this this is how I think
  3479. 2:37:22about my trading portfolio at Peak
  3480. 2:37:25trading research we are incubating
  3481. 2:37:27hundreds of different systematic trading
  3482. 2:37:30strategies those strategies that are
  3483. 2:37:32performing best that are most in tune
  3484. 2:37:35with the market that are generating
  3485. 2:37:37paper profits including the realistic
  3486. 2:37:40costs of slippage and commissions those
  3487. 2:37:42strategies rise up to become the peak 10
  3488. 2:37:46list that we post monthly at Peak
  3489. 2:37:48algo.com so for my own trading I always
  3490. 2:37:52have a list of strategies right in front
  3491. 2:37:54of me every month via the peak 10 that
  3492. 2:37:57could easily replace any underperforming
  3493. 2:38:01strategies that I'm currently trading so
  3494. 2:38:03whether you are getting new strategies
  3495. 2:38:06from YouTube channels or strategy
  3496. 2:38:08courses or from strategy books or you
  3497. 2:38:11have access to the same list of great
  3498. 2:38:13real-time strategies that I'm looking at
  3499. 2:38:15every month from peakalgo.com you should
  3500. 2:38:18have a deep bench you should have a list
  3501. 2:38:21of strategies that you are ready to
  3502. 2:38:23promote if you want to relegate some of
  3503. 2:38:26your underperforming strategies bottom
  3504. 2:38:29line strategies underperform strategies
  3505. 2:38:32break have a game plan in place for when
  3506. 2:38:35this happens have a predefined threshold
  3507. 2:38:39in place that helps you automate the
  3508. 2:38:41decision process or around when to turn
  3509. 2:38:44off an underperforming strategy and
  3510. 2:38:46finally have a deep bench have a list of
  3511. 2:38:50strategies incubating that are
  3512. 2:38:52performing well in real time that you
  3513. 2:38:54can promote to your portfolio to replace
  3514. 2:38:57those relegated underperforming
  3515. 2:39:00systematic trading strategies following
  3516. 2:39:02these three steps will help you deal
  3517. 2:39:04with drawdowns effectively turn off
  3518. 2:39:07underperforming trading systems and
  3519. 2:39:10improve the long-term performance of
  3520. 2:39:13your portfolio of systematic trading
  3521. 2:39:16strategies
  3522. 2:39:19thank you
  3523. 2:39:23in algorithmic trading psychology still
  3524. 2:39:27matters any systematic Trader who has
  3525. 2:39:30turned on real algorithmic trading
  3526. 2:39:32strategies will tell you that there are
  3527. 2:39:35ups and downs for making and losing
  3528. 2:39:37money in this section we'll talk about
  3529. 2:39:39algorithmic trading psychology some of
  3530. 2:39:42the common pitfalls of algorithmic
  3531. 2:39:44trading and we're going to do that by
  3532. 2:39:46walking through 10 actionable tips that
  3533. 2:39:49you can use to stay in the game used to
  3534. 2:39:51your confidence and improve your
  3535. 2:39:53long-term trading profitability tip
  3536. 2:39:56number one is focus on what you can
  3537. 2:39:59control as a systematic Trader you are
  3538. 2:40:02not making decisions when markets move
  3539. 2:40:05that is what your trading system is set
  3540. 2:40:08up to do and the good news is that that
  3541. 2:40:10system is going to make those decisions
  3542. 2:40:12more quickly and more accurately than
  3543. 2:40:15you ever could now for many algorithmic
  3544. 2:40:17Traders myself included that's a huge
  3545. 2:40:20positive it's a huge relief to not have
  3546. 2:40:23to to be glued to markets all the time
  3547. 2:40:25your role as a systematic Trader is to
  3548. 2:40:29make sure that your system is working
  3549. 2:40:31correctly most importantly that your
  3550. 2:40:33positions match like we talked about in
  3551. 2:40:36the section on getting started that you
  3552. 2:40:38are trading the correct contract and
  3553. 2:40:41that your trading platform is
  3554. 2:40:43consistently connected to the market
  3555. 2:40:45remember that your trading systems are
  3556. 2:40:47set up to make money over the course of
  3557. 2:40:49months and quarters and years not every
  3558. 2:40:53single minute of the day there is no
  3559. 2:40:55trading system that can do that again
  3560. 2:40:57focus on what you can control tip number
  3561. 2:41:01two is trust the process as Larry
  3562. 2:41:04Williams said trading systems work
  3563. 2:41:07system Traders do not if you turn on a
  3564. 2:41:11systematic trading strategy you have
  3565. 2:41:13gone through a lot of steps to get to
  3566. 2:41:15that point you've built this strategy
  3567. 2:41:18optimize the strategy tested it
  3568. 2:41:20incubated it your system is set up to be
  3569. 2:41:23a great Trader and make great decisions
  3570. 2:41:26let it run tip number three is be
  3571. 2:41:29consistent one of the first things that
  3572. 2:41:32I noticed when I started systematic
  3573. 2:41:34trading when I actually turned on real
  3574. 2:41:37trading strategies was how slow it is
  3575. 2:41:40most successful systematic trading
  3576. 2:41:43strategies especially the ones that
  3577. 2:41:45consider the realistic costs of slippage
  3578. 2:41:48and commissions are multi-day or
  3579. 2:41:51multi-week breakout and swing strategies
  3580. 2:41:54this means that even if you are running
  3581. 2:41:56a basket of 20 or 30 or 40 different
  3582. 2:42:00trading systems there might be days that
  3583. 2:42:03you don't have any new trades profitable
  3584. 2:42:06systematic trading is a long haul it's a
  3585. 2:42:09process it can move slower than you
  3586. 2:42:11might anticipate now I love Equity
  3587. 2:42:14curves I love looking at those nice
  3588. 2:42:16upward sloping cumulative profit lines
  3589. 2:42:19the type that we've gone through again
  3590. 2:42:21and again in this course but they can
  3591. 2:42:23and be deceptive remember for those
  3592. 2:42:26Equity curves we're often looking at 10
  3593. 2:42:2812 15 years of data and if you look at
  3594. 2:42:32any Equity curve there are periods of
  3595. 2:42:35months or quarters or sometimes even
  3596. 2:42:37years of underperformance so again be
  3597. 2:42:40consistent and expect that this process
  3598. 2:42:43might take a little longer than you
  3599. 2:42:45first anticipated this tip reminds me of
  3600. 2:42:48one of my favorite tweets that applies
  3601. 2:42:50not just to trading but to life in
  3602. 2:42:53general ninety percent of success can be
  3603. 2:42:55boiled down to consistently doing the
  3604. 2:42:58obvious thing for an uncommonly long
  3605. 2:43:00period of time without convincing
  3606. 2:43:03yourself that you're smarter than you
  3607. 2:43:05are be consistent commit to your trading
  3608. 2:43:08systems and Trust the process tip number
  3609. 2:43:11four is aggressively eliminate the
  3610. 2:43:14things that can go wrong in your trading
  3611. 2:43:17process trading is all about confidence
  3612. 2:43:20and eliminating the things that can go
  3613. 2:43:23wrong will help boost your confidence
  3614. 2:43:25one of the biggest pitfalls here with
  3615. 2:43:28systematic trading is connectivity is
  3616. 2:43:31making sure that your trading platform
  3617. 2:43:33can access the market if you are worried
  3618. 2:43:36about your computer losing power or
  3619. 2:43:38losing its connection to the internet
  3620. 2:43:40you should strongly consider using a
  3621. 2:43:43virtual private server a VPS some great
  3622. 2:43:47virtual private server options include
  3623. 2:43:50Speedy trading servers who I've used
  3624. 2:43:52before and been really impressed with
  3625. 2:43:54there's ovh there's Speedy page all of
  3626. 2:43:58these companies are great Solutions
  3627. 2:44:00they'll offer you 99.9 uptime and most
  3628. 2:44:04importantly a virtual private server
  3629. 2:44:06will give you the confidence that you
  3630. 2:44:09are always connected to the market and
  3631. 2:44:11this idea of eliminating the things that
  3632. 2:44:14can go wrong also applies to your
  3633. 2:44:16trading platform if you find that
  3634. 2:44:18tradestation is missing trades stop
  3635. 2:44:21using tradestation if you find find that
  3636. 2:44:23multi-charts is not mapping contracts
  3637. 2:44:26correctly stop using multi-charts if
  3638. 2:44:29your trading platform is not working for
  3639. 2:44:31you use a different trading platform now
  3640. 2:44:34I'm going to lean in here to properly
  3641. 2:44:36emphasize this next point no matter what
  3642. 2:44:39do not under any circumstance try to
  3643. 2:44:43build your own trading platform the road
  3644. 2:44:46to profitable systematic trading is
  3645. 2:44:49littered with the bones of traders who
  3646. 2:44:52have tried to build their own trading
  3647. 2:44:54platforms you have a lot of great
  3648. 2:44:56options find one that works for you and
  3649. 2:44:59run with it and again to bring back a
  3650. 2:45:01point from earlier in this course your
  3651. 2:45:04advantage your role as a systematic
  3652. 2:45:06Trader is in building a basket of
  3653. 2:45:09uncorrelated systematic trading
  3654. 2:45:12strategies do your best to eliminate
  3655. 2:45:15anything that gets in the way of that
  3656. 2:45:17tip number five is be pragmatic be
  3657. 2:45:20realistic think like a carpenter your
  3658. 2:45:24strategies are tools for making money if
  3659. 2:45:27that tool stops working stop using that
  3660. 2:45:31tool there is no such thing as a perfect
  3661. 2:45:33trading strategy there are no trading
  3662. 2:45:36strategies that are worth falling in
  3663. 2:45:38love with again be pragmatic if your
  3664. 2:45:40strategies are making you money keep
  3665. 2:45:43trading those strategies if they stop
  3666. 2:45:45making you money turn off those
  3667. 2:45:47strategies tip number six follows tip
  3668. 2:45:50number five nicely and that is Define
  3669. 2:45:53your rules and stick to your rules if
  3670. 2:45:55you have written down ahead of time a
  3671. 2:45:58threshold where you will turn off a
  3672. 2:46:00strategy and you get to that threshold
  3673. 2:46:02turn off that strategy and on the flip
  3674. 2:46:05side if you have a strategy position
  3675. 2:46:06that's performing really well and making
  3676. 2:46:09a lot of money don't just take profit on
  3677. 2:46:11that position maybe that position is
  3678. 2:46:13from a strategy that aims to catch big
  3679. 2:46:16breakout moves and maybe that long-term
  3680. 2:46:19Equity curve relies on you catching some
  3681. 2:46:21of those big breakouts moves Define your
  3682. 2:46:24rules ahead of time stick to those rules
  3683. 2:46:27automate your decision-making process
  3684. 2:46:30and trust your systems let your trading
  3685. 2:46:33systems run and believe me I know that's
  3686. 2:46:36easier said than done this is a quote
  3687. 2:46:38from the book trading systems by Urban
  3688. 2:46:40Jackal and Emilio tomassini once you
  3689. 2:46:43have a trading system the biggest
  3690. 2:46:45obstacle is trusting it tip number seven
  3691. 2:46:49is start small and start before you're
  3692. 2:46:52ready you are going to learn so much
  3693. 2:46:55from your first actual live systematic
  3694. 2:46:58strategy trade it is a huge deal to
  3695. 2:47:02start actually trading so do what you
  3696. 2:47:04can to get to that point if that means
  3697. 2:47:07paper trading for a while in a Sim
  3698. 2:47:09account or it means trading a mini
  3699. 2:47:11contract or a contract with a smaller
  3700. 2:47:14notional size do whatever you can to
  3701. 2:47:17take that big step to go from analyzing
  3702. 2:47:20algo strategies to actually Trading algo
  3703. 2:47:24strategies and remember to listen to
  3704. 2:47:26your guts start in a way that you feel
  3705. 2:47:28comfortable with if your portfolio has
  3706. 2:47:31too much volatility or you're up at
  3707. 2:47:33night thinking about any one system or
  3708. 2:47:35any one position pump the brakes a
  3709. 2:47:38little bit remember in the end winning
  3710. 2:47:40is sleeping better tip number eight is
  3711. 2:47:44view algorithmic trading as a project
  3712. 2:47:47view it as an investment in your
  3713. 2:47:49education and your analytical tool set
  3714. 2:47:52if you are connected to markets in any
  3715. 2:47:55way it is a huge deal that you
  3716. 2:47:58understand algorithmic trading the key
  3717. 2:48:01Concepts that you have learned in this
  3718. 2:48:04course around coding strategy building
  3719. 2:48:06risk and portfolio management market
  3720. 2:48:09dynamics have big benefits Beyond just
  3721. 2:48:13the profitability of the trading
  3722. 2:48:15strategies that you're running another
  3723. 2:48:16way to say all this is whether you're in
  3724. 2:48:19economics or Finance or commodity
  3725. 2:48:21markets if you want potential employers
  3726. 2:48:24and Headhunters running to your LinkedIn
  3727. 2:48:28page you need to lean into quantitative
  3728. 2:48:31analysis and algorithmic trading but
  3729. 2:48:34again view all of this as a project as a
  3730. 2:48:37process that is worth investing in tip
  3731. 2:48:40number nine is don't go It Alone find
  3732. 2:48:44other traders that you can talk to and
  3733. 2:48:47find other traders that you can share
  3734. 2:48:49systems with now I used to obsess about
  3735. 2:48:52not sharing systems I used to think that
  3736. 2:48:55I had some proprietary view on the
  3737. 2:48:58market and if I shared it with one or
  3738. 2:49:00two other traders that might lose some
  3739. 2:49:02Edge when I first got into strategy
  3740. 2:49:05development I even hired some coders and
  3741. 2:49:07I'd make them sign ndas so that they
  3742. 2:49:10wouldn't share any of my code elsewhere
  3743. 2:49:12now I have completely gotten over that
  3744. 2:49:15for a few different reasons first of all
  3745. 2:49:17any trading system that you can come up
  3746. 2:49:20with has probably been built before
  3747. 2:49:22there are hedge funds out there that are
  3748. 2:49:24using Quantum Computing to test millions
  3749. 2:49:27of different strategies every year
  3750. 2:49:29they've probably figured out your
  3751. 2:49:31trading strategy and if you do share a
  3752. 2:49:34trading system anyone who looks at that
  3753. 2:49:36system will likely make their own small
  3754. 2:49:38tweaks so it ends up executing in a
  3755. 2:49:41slightly different way than your system
  3756. 2:49:42in the first place Richard Dennis who
  3757. 2:49:45came up with the turtle trading system
  3758. 2:49:47famously said I could publish my rules
  3759. 2:49:49in the newspaper and no one would follow
  3760. 2:49:52them there is so much upside from
  3761. 2:49:54sharing strategies from talking to other
  3762. 2:49:57Traders about what they're doing what
  3763. 2:49:59they're actually trading how they think
  3764. 2:50:01about markets that is so much greater
  3765. 2:50:03than the downside of another Trader
  3766. 2:50:05maybe trading your exact trading system
  3767. 2:50:08in a huge liquid Market it probably
  3768. 2:50:11won't even make a difference bottom line
  3769. 2:50:13don't go It Alone find a network of
  3770. 2:50:16other Traders and don't be afraid to
  3771. 2:50:19share your trading systems tip number 10
  3772. 2:50:22is 5 find your Edge find what you are
  3773. 2:50:26good at find what makes your trading
  3774. 2:50:28different and profitable and really lean
  3775. 2:50:31into that maybe it's structuring
  3776. 2:50:33seasonal trades or finding a unique way
  3777. 2:50:35to analyze commitment of Traders data or
  3778. 2:50:38maybe you work for a big commercial
  3779. 2:50:39Trading Company and you have access to
  3780. 2:50:41private cash data or weather data that
  3781. 2:50:44no one else has access to or maybe you
  3782. 2:50:47like trading those smaller a liquid
  3783. 2:50:49commodity markets like orange juice and
  3784. 2:50:51rice and lumber that most hedge funds
  3785. 2:50:54just don't have access to find your Edge
  3786. 2:50:57find what makes you profitable and lean
  3787. 2:50:59into it there it is there are 10 tips
  3788. 2:51:02that can help your algorithmic trading
  3789. 2:51:04psychology boost your confidence and
  3790. 2:51:07help you avoid some of the pitfalls of
  3791. 2:51:09algorithmic trading
  3792. 2:51:13thank you
  3793. 2:51:17whether you are a professional commodity
  3794. 2:51:20Trader or you are a beginner who
  3795. 2:51:22understands the huge advantages of
  3796. 2:51:25systematic trading there is a lot of
  3797. 2:51:27upside for you in your professional
  3798. 2:51:29development and your trading
  3799. 2:51:31profitability to learn more about
  3800. 2:51:33systematic trading so beyond this course
  3801. 2:51:36let's talk about what are the other
  3802. 2:51:38resources that are out there that are
  3803. 2:51:40available to you specifically books
  3804. 2:51:42strategy testing tools strategy building
  3805. 2:51:45courses and YouTube channels what are
  3806. 2:51:48the best books on algorithmic trading
  3807. 2:51:51these are my top four in order of when
  3808. 2:51:55they were published number one design
  3809. 2:51:57testing and optimization of trading
  3810. 2:52:00systems by Robert Pardo number two
  3811. 2:52:03beating the financial Futures Market by
  3812. 2:52:06Art Collins number three trading systems
  3813. 2:52:09by Urban Jackal and Emilio thomasini and
  3814. 2:52:12number four building winning algorithmic
  3815. 2:52:15trading systems by Kevin Davey all four
  3816. 2:52:18of these books are fantastic resources
  3817. 2:52:21that cover strategy development testing
  3818. 2:52:24optimization risk management portfolio
  3819. 2:52:27construction effectively the building
  3820. 2:52:30blocks for constructing realistic
  3821. 2:52:32systematic trading strategies that have
  3822. 2:52:35the best chance of working well in real
  3823. 2:52:37time what are the most popular
  3824. 2:52:39algorithmic trading strategy courses the
  3825. 2:52:43three courses that I hear of the most
  3826. 2:52:45often are Kevin Davies strategy Factory
  3827. 2:52:48course Andrea Unger's Unger Academy and
  3828. 2:52:52Jeff Swanson's easy language Mastery
  3829. 2:52:55courses now I've taken a few paid
  3830. 2:52:58courses from Kevin Davey I've attended a
  3831. 2:53:01few seminars hosted by Andrea Unger and
  3832. 2:53:04I'm a big fan of Jeff Swanson's blog all
  3833. 2:53:07of these guys have slightly different
  3834. 2:53:09approaches to strategy testing strategy
  3835. 2:53:12walk forwards the use of filters and
  3836. 2:53:15custom bar charts but all three of these
  3837. 2:53:17forces are good options if you want to
  3838. 2:53:20get deeper into systematic trading what
  3839. 2:53:23are the best strategy testing tools the
  3840. 2:53:26top three here are multi-opt which
  3841. 2:53:29follows the same walk forward heavy
  3842. 2:53:31strategy development process taught by
  3843. 2:53:33Kevin Davey the DL pal deep learning
  3844. 2:53:37price action Lab at
  3845. 2:53:39priceactionlab.com it analyzes lots of
  3846. 2:53:42different price patterns to develop
  3847. 2:53:44strategies and finally the build Alpha
  3848. 2:53:47strategy development tool at build
  3849. 2:53:49alpha.com finally what are the best
  3850. 2:53:53YouTube channels this list is very small
  3851. 2:53:56in terms of channels that show actual
  3852. 2:53:58strategy code and realistic Equity
  3853. 2:54:01curves including the cost of slippage
  3854. 2:54:05and commissions it basically comes down
  3855. 2:54:07to Kevin Davey's Channel and the peak
  3856. 2:54:10trading research Channel I can't count
  3857. 2:54:12the number of times that I've seen a
  3858. 2:54:14trading Channel share a beautiful upward
  3859. 2:54:17slope Equity curve with hundreds of
  3860. 2:54:19Trades and then someone inevitably asks
  3861. 2:54:22in the comments well did you include
  3862. 2:54:24commission costs did you include the
  3863. 2:54:26slippage costs of trading that contracts
  3864. 2:54:29so many times and the Creator's answer
  3865. 2:54:32is always inevitably well I didn't but
  3866. 2:54:35it's not that much it's not a big deal
  3867. 2:54:37well if it's not a big deal if it's not
  3868. 2:54:39a big cost included in your development
  3869. 2:54:42process otherwise it's not a realistic
  3870. 2:54:45system this was part of the reason that
  3871. 2:54:47we started our strategy of the month
  3872. 2:54:50videos which have now been running for
  3873. 2:54:52more than a year this is where we show
  3874. 2:54:54fully coded realistic trading systems
  3875. 2:54:58that perform well including the cost of
  3876. 2:55:00slippage and commissions across all
  3877. 2:55:03major agriculture energy and metals
  3878. 2:55:05markets month after month so that's it
  3879. 2:55:08that's the list of strategy books
  3880. 2:55:11strategy testing tools strategy building
  3881. 2:55:14courses and YouTube channels that can
  3882. 2:55:17help you on your journey to profitable
  3883. 2:55:19systematic trading and of course if
  3884. 2:55:22you're interested in fully coded
  3885. 2:55:24systematic trading strategies that are
  3886. 2:55:26performing well in real time you can
  3887. 2:55:29subscribe to our Peak 10 monthly
  3888. 2:55:32strategies at Peak algo.com and you can
  3889. 2:55:35follow Peak trading research on YouTube
  3890. 2:55:38on LinkedIn and on Twitter for commodity
  3891. 2:55:41Market insights and real systematic
  3892. 2:55:43trading strategies bottom line there are
  3893. 2:55:46a lot of great resources out there for
  3894. 2:55:49you and there is no better investment in
  3895. 2:55:52your future career and your trading
  3896. 2:55:54profitability than to learn more about
  3897. 2:55:57algorithmic trading
  3898. 2:56:01thank you
  3899. 2:56:05one final comment to wrap up this 2023
  3900. 2:56:09algorithmic trading course you can do
  3901. 2:56:12this you can build test and automate
  3902. 2:56:15systematic trading strategies to reap
  3903. 2:56:18all the massive advantages of
  3904. 2:56:20evidence-based trading you have the
  3905. 2:56:22building blocks you need the tools you
  3906. 2:56:25need the additional resources you can
  3907. 2:56:27reference and my hope is that this
  3908. 2:56:29algorithmic trading course helps put you
  3909. 2:56:32on a path in terms of your education
  3910. 2:56:34your confidence and your training
  3911. 2:56:37profitability if you have any questions
  3912. 2:56:39or feedback about this course you can
  3913. 2:56:42leave them in the comments below if
  3914. 2:56:44you'd like access to the full
  3915. 2:56:472023 algal course packet you can find it
  3916. 2:56:50at peakalgo.com good luck algorithmic
  3917. 2:56:54trading and we'll see you soon
  3918. 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.