SystemTrader



Robert Carver worked in the City of London for over a decade. For seven years he was a portfolio manager at AHL — one of the world’s largest systematic hedge funds — before, during and after the global financial meltdown of 2008.

Currently, the repository opened the strategy code, exchange api code, backtest code, complementary tools code. For the base part of strategy, I just make it as a dynamic library in external, ok to use, but code is not included here, the reason is that something i am now still debugging. SystemTrader is not only a charting software, it also allows you to track your portfolio, to backtest your trading systems, and to scan the stock market for opportunities. SystemTrader is a native Mac application and follows the Apple Human Interface Guidelines. In other words, it looks and behaves the way Mac software is supposed to.

In this interview, we talk about many trading topics, mostly around the systematic approach and why it’s so important for most of us to base the decision-making process on rules rather than discretion. Robert also explains why the most important factor to consider when investing is risk.

You can hear how people managing billions of dollars were considering liquidation of market positions during the 2008 crisis, while at the same time, mechanical strategies made over a billion dollars in a single day. The fund’s computer system had stuck to its preprogrammed set of trading rules and mechanically exploited the market moves almost to perfection, while terrified humans had discussed closing it down.

Although we discussed many negative aspects of trading and investing, there’s a positive message to all of us as well. With enough discipline and work, most of us may construct an investing vehicle at home and build our own capital successfully.

Listen to “STS 015 – Over a billion dollars in a single day – Robert Carver, an ex-hedge fund manager about professional approach to systematic trading” on Spreaker.

Some people think that gambling is bad, and investing is good, with trading perhaps somewhere in the middle. I disagree. All involve putting money at risk, with an uncertain outcome. What is bad is when someone is betting when they are guaranteed to lose on average, or when they put too much of their capital into a particular bet, or both. This sort of behaviour is rare amongst professional poker players, but is common amongst amateur gamblers and traders alike. There is nothing wrong with gambling, investing or trading; as long as you know what you are doing and never bet or invest when the odds are against you.

In this episode

  • Rob’s career and trading experience
  • Is working for a hedge fund is a good way to learn about investing?
  • May an average retail investor learn professional’s skills at home?
  • A short overview of Rob’s books
  • What’s his trading approach?
  • How much time does Rob dedicate to his investments per day?
  • Is there a difference between trading and investing?
  • Is it reasonable to invest money through an active fund, for example, a mutual fund?
  • Does use robo-advisors make sense?
  • What are risk and volatility?
  • How to measure risk?
  • Trading styles:
    • static vs dynamic
    • positive vs negative skew
    • trading speed
    • technical vs fundamental analysis
  • Why is the trend following a reliable approach to investing?
  • What is mean reversion?
  • Why is day trading tougher than most people think?
  • Does technical analysis work and why it has such a bad reputation?
  • What is systematic trading all about?
  • Types of system traders/investors:
    • asset allocating investor
    • semi-automatic trader
    • staunch system trader
  • Computers vs humans: a story about how mechanical trading strategy made over a billion dollars in a single day
  • Why doesn’t systematic trading look appealing to most of us?
  • What is a well-designed system?
  • What does Rob think about advanced techniques like genetic programming algorithms, machine learning, or other artificial intelligence applications?
  • How much data is needed for system testing?
  • What is the minimal number of transactions to trust the system?
  • What tools/programming languages does Rob use?
  • What does Rob think about High-Frequency Trading?
  • Should an average investor be afraid of HFT?
  • Rob’s investing advice for the beginners
  • Robs review of the latest book about Jim Simons (The Man Who Solved the Market: How Jim Simons Launched the Quant Revolution)
  • Recommended books/blogs/podcasts/other sources?

About Rob Carver

Robert Carver is an independent systematic futures trader, writer and research consultant; and a visiting lecturer at Queen Mary, University of London.

Trader

He is the author of “Systematic Trading: A unique new method for designing trading and investing systems” (Harriman House, 2015), “Smart Portfolios: A practical guide to building and maintaining intelligent investment portfolios” (Harriman House, 2017), and “Leveraged Trading: A professional approach to trading FX, stocks on margin, CFDs, spread bets and futures for all traders” (Harriman House, 2019).

Until 2013 Robert worked for AHL, a large systematic hedge fund, and part of the Man Group. He was responsible for the creation of AHL’s fundamental global macro strategy, and then managed the funds multi billion dollar fixed income portfolio. Prior to that Robert worked as a research manager for CEPR, an economics think tank, and traded exotic derivatives for Barclays investment bank. He spent his early career in the Middle East.

Robert has a Bachelors degree in Economics from the University of Manchester, and a Masters degree, also in Economics, from Birkbeck College, University of London.

People mentioned in this episode

Some useful links

  • Recommended literature
    • Systematic Trading: A unique new method for designing trading and investing systems” (Rob Carver, Harriman House, 2015)
    • Smart Portfolios: A practical guide to building and maintaining intelligent investment portfolios” (Rob Carver, Harriman House, 2017)
    • Leveraged Trading: A professional approach to trading FX, stocks on margin, CFDs, spread bets and futures for all traders” (Rob Carver, Harriman House, 2019)
    • The Man Who Solved the Market: How Jim Simons Launched the Quant Revolution (Gregory Zuckerman, Portfolio, 2019)

Comments are welcome!

I encourage you to comment on this episode. You can do this by pressing the button below. Please also visit my profile on Twitter. 🙂
I really count on your voice! Thank you! 🙂

Do you like what you see?

If you want me to inform you next time I have a new article/podcast episode, sign up below for my newsletter!

There was an error submitting your subscription. Please try again.

Thanks for joining! Check your email to complete your subscription

Previous Post: 🔊 STS 014 – Paul Novell: investing for a living, financial independence and early retirement

Next Post: 🔊 STS 016 – Meb Faber: Why an investment plan is a must and how to behave in the period of a market crash?

.... Universe and Trend Filter
.... Bollinger Band Setup Code
.... StockRSI Trigger Code
.... Rate-of-Change Sort Code
.... Scan Code in Full
.... TTM Technologies Setup and Signal
.... Conclusions and Suggestions ....

Scan Code for Bollinger Band Squeeze

This article will focus on the scan code for last week's System Trader article featuring the Bollinger Band Squeeze. In addition to ready-to-use scan code, I will also explain the method behind the madness and share some coding techniques that can be applied to other scans. There are four parts to this scan. First, we select the symbol universe and add a basic trend filter. Second, we scan for the setup, which is the Bollinger Band squeeze. Third, we scan for the trigger or signal, which is the pop in StochRSI. Fourth, we add a 'Rank by' function to sort the results. The chart below shows BSX with these indicators and the key levels.

Universe and Trend Filter

First, we select the symbol universe and filter for uptrends. There are two code lines shown below with explanations just above the code. Each code line acts as a filter to narrow down the symbol universe in our database. Notice that the explanations start with two forward slashes. The text following the two forward slashes is ignored by the scan engine and is used for explanation notes.

In the example above, each individual filter is enclosed with brackets [Group is SP500]. The first three filters are then enclosed by brackets (red) and separated by 'or'. I enclosed this entire line with brackets to ensure that these arguments are grouped. The next line of code ensures that the stock is in a long-term uptrend.

// stock's 50-day EMA is above 200-day EMA
[EMA(50,close) > EMA(200,close)]

Bollinger Band Setup Code

The next part of the scan produces the setup. The Bollinger Band squeeze uses the BandWidth indicator to find stocks with narrow Bollinger Bands. Unfortunately, not all stocks are equal when it comes to volatility. A utility stock, such as Southern (SO), will have lower volatility than a high growth stock such as Netflix (NFLX). This means the definition of low BandWidth will likely be different for these two stocks. I will, therefore, show two different methods to find narrowing Bollinger Bands (low BandWidth).

The first method looks for the 10-day low of BandWidth (20,2) to be below the lowest BandWidth value of the prior 115 days. The 'Min' function is used to find the lowest value. For example, [Min(10,close)<50] would find stocks that had a value below 50 at some point over the last 10 days.

// The low of BandWidth over the last 10 days
// is below the low of BandWidth over the prior 115 days
[Min(10,BB Width(20,2)) < 11 days ago Min(115,BB Width(20,2))]

The second part of the filter (after the less than sign <) starts 11 days before the first part. It is looking for the lowest BandWidth value over the last 115 days starting 11 days ago. The chart below shows an example highlighting the last 10 days of BandWidth in green and the 115 days prior to that in blue. Notice that the lowest low of the10 day period is below the lowest low of the 115 day period.

The second method is more straightforward because I am simply looking for BandWidth to be below 6% at anytime over the last 10 days. Keep in mind that you can alter this code to fit your trading preferences. Chartists looking for fewer results can use a lower threshold for BandWidth (below 5 instead of 6). Chartists looking for more results can use a higher threshold. Study some charts and see what works best for you.

// BandWidth was below 6 at some point over the last 10 days
[Min(10,BB Width(20,2)) < 6]

When running through the results, I also decided to add another filter to insure that BandWidth had not already shot up. A surge in BandWidth would suggest that the stock already made its move and I would not want it in the results. Remember, BandWidth does not have a directional bias. It simply rises when the Bollinger Bands expand. This filter insures that current BandWidth is still below 10.

// BandWidth is currently below 10
[BB Width(20,2) < 10]

StochRSI Trigger Code

The next part of the scan code is the actual trigger. Some chartists may want to leave this out and simply look at the charts with narrow Bollinger Bands. Chartists looking for an actual signal can consider a surge in StochRSI. This filter looks for instances when StochRSI 10 crossed above .80.

// StochRSI(10) crosses above .80
[[Stoch RSI(10) x 0.80]
or [1 day ago Stoch RSI(10) x 0.80]
or [2 days ago Stoch RSI(10) x .80]]

You may notice that I also added two lines to find crosses that occurred on the previous two days. This is handy when you are not scanning every day or when you want to review recent signals. Again, notice that each filter is enclosed in brackets and separated by 'or'. The entire sequence (all three signals) is then enclosed by brackets.

Rate-of-Change Sort Code

The final line is the 'Rank by' function. This places the best performers at the top and acts as a selection mechanism when there are too many stocks to choose from. For example, we need to make a selection when we have 30 results and room for only 5 positions. The 'Rank by' function is not a filter and does not require brackets. Using a ranking to sort is totally optional.

// results are ranked by 125-day Rate-of-Change
// this is the last line in the scan
Rank by ROC(125)

Scan Code in Full

The entire code is shown below. Notice that I added 'AND' before the code lines (after the first line) to ensure that they are tied together. You do not need to precede the 'Rank by' function with 'AND' because it is not a filter.

// stock universe is the S&P 1500
[[group is SP500] or [group is SP400] or [group is SP600]]

// stock's 50-day EMA is above 200-day EMA
AND [EMA(50,close) > EMA(200,close)]

// Method 1: The low of BandWidth over the last 10 days
// is below the low of BandWidth over the prior 115 days
AND [Min(10,BB Width(20,2)) < 11 days ago Min(115,BB Width(20,2))]

// Method 2: BandWidth was below 6 at some point over the last 10 days
// You can use method 1, method 2 or both
AND [Min(10,BB Width(20,2)) < 6]

// BandWidth is currently below 10
AND [BB Width(20,2) < 10]

// StochRSI(10) crosses above .80
AND [[Stoch RSI(10) x 0.80]
or [1 day ago Stoch RSI(10) x 0.80]
or [2 days ago Stoch RSI(10) x .80]]

// Sort by 125-day Rate-of-Change
Rank by ROC(125)

TTM Technologies Setup and Signal

The example below shows TTM with a setup and signal in late March. Notice that this signal triggered before the stock actually broke out. TTMI subsequently broke out and even fell back below the breakout the very next day. Even so, I would not consider this breakout a failure as long as the stocks holds support in the 15.15.5 area.

After running the scan and viewing the resulting charts, I notice that StochRSI often triggers a signal when the stock is still in the consolidation phase. In other words, StochRSI(10) pops above .80 and the stock is still within the narrowing bands. This signal can be a bit early (wrong) because the stock has yet to actually break out. The scan results represent the first cut. We should also look at the individual charts and apply our preferred methods for the trigger signal. Perhaps it is a MACD upturn, a high volume up day or a candlestick reversal.

Conclusions and Suggestions

System Trader Pl

This is a long only system designed to find stocks that are consolidating in some way shape or form. Although not part of the scan code, I also require the 50-day EMA of the S&P 500 to be above the 200-day EMA. This is my basic bull market filter. We cannot add this to the scan code, but it is something we should know already because it is a key metric for identifying bull and bear markets.

System Trader Success

I did not add an exit because we cannot scan for the future! The exit in the original article was based on RSI(10) moving below 30. I would also suggest that traders consider using profit-based targets for exits. In other words, exit with a 15-20% profit or exit when the stock hits your profit target based on chart analysis. This is a good system to find entries, but requires more work for the exit part, which is always the hardest part.

******************************************************
Thanks for tuning in and have a good day!
--Arthur Hill CMT

Plan your Trade and Trade your Plan
******************************************************

Other Articles in the SystemTrader Series:

  • Introduction to Key Performance Metrics - Quantifying the Golden Cross for the S&P 500
  • Golden Cross and 5 Major Indexes - EMAs versus SMAs - Do Short Positions Add Value?
  • Setting up Momentum Scans, Creating ChartLists and Exporting Lists.- Differences in Major Indexes - Do Trend Filters Work?
  • MACD Crosses- Rules to Reduce Drawdowns and Increase Gains- Testing PPO Strategy
  • Follow me on Twitter @arthurhill - Keep up with my 140 character commentaries.