The post Trading Mean Reversion in Currencies appeared first on FXMasterCourse.

]]>We saw in the last article how combining two simple ideas for equities produced a stable system over the last 30 years.

Can we repeat a similar analysis for currencies?

**Yes! **

However, be warned. Currency trading is a different magnitude of difficulty to equity trading. Currency traders have had a real tough time since 2008 (take a look at the BTOP Barclay Hedge Currency Trader Index).

As always it depends which pond you fish in. Whereas equities can see slow trend grinds, or explosive surges, currencies are much more choppy. Have you ever seen a G10 currency perform a “Yahoo party like it’s 1999” dance?

In this article we’ll cover:

- Defining Mean Reversion again
- Finding the Right Pond to Fish in
- Testing Patterns for Mean Reversion
- Constructing a real simple but well performing mean-reverting portfolio
- Using the benefit of Diversification to combine it with our Equity strategy

Recall: Mean Reversion Trading means fading strong moves. Usually towards their points of origin, the ** mean** of the price series.

In this article series we covered two approaches:

- Look at the 5-day moving average (one week seems magical across assets) and trade from the other side
- Look at sequences of up and down periods.

Let’s apply these two concepts to currencies as well.

And let’s start out with EURUSD.

Why EURUSD? Well, it’s considered to be one of the most ‘technical’ currencies (at least anecdotally). More tangible characteristics: it’s certainly the most liquid, has a low/bid ask spread, and for the purpose of testing our ideas, it’s certainly exhibited strongly trending, range-bound, high-vol and low-vol environments. This makes it a good beast to try out at first.

Recall, that the 5-day moving average approach was to trade in the direction opposite to the short-term trend. Meaning we were long if EURUSD is below its moving average and short if it is above.

You might ask, why 5-days. You can certainly vary this. However, I felt that since we fixed this period in the previous article, it’s a good example of how to look for universal properties, and not get bogged down in parameter searches.

The (minutely) data was obtained from ForexTester’s historical data service, which is sourced from a list of brokers. This is a good test to have. If different data sources provide very similar results, you know that you are not dealing with some spurious data quality issues.

The Sharpe ratio here is at 0.5.

So what about GBPUSD? Or USDJPY?

This is what it looks like for the two:

Not too good.

*Now this is important: Looking for the right pond to fish in!*

What do I mean by this? Forget about the majors for starters.

Would you recognize this pair without me telling you what it is?

Difficult!

It’s actually CAD/NOK. What’s interesting about this pair: almost no retail broker will show it.

Furthermore, both CAD and NOK as economies are strongly related due to their oil production. So it makes sense for them to strongly related.

How strongly?

Let’s use the 5-day MA method from before:

The Sharpe Ratio alone on this is 1.16! Pretty impressive.

So here is an exercise: find as many ** “off”** pairs as you can think of. Obviously you will have to construct them. CAD/NOK = USD/NOK divided by USD/CAD, where you can obtain the data from sources such as your MT4 History Center.

We’re going to stick with the concept of 5 business days, better said a week (the signal over dailies is too noisy, and not much comes of it).

Similar to the equities setup we’re going to try something really naïve.

If the last week’s currency move was up, go short, and vice versa. If the last week’s currency move was down, go long.

At first sight this might not seem like much.

Here are the results for this approach for 28 pairs typically found on brokers (same data set as before with FXOpen as the source).

Aggregating these results we obtain:

Note that we haven’t cherry picked any of the currencies which had underperforming periods.

There might be some arguments to be made for selecting only those that visibly clearly exhibit ‘mean-reverting’ characteristics, such as the CHF pairs.

It turns out the Sharpe Ratio for this strategy is at 0.7.

That is pretty astonishing.

And there are some key subtleties here. The most important one is that we are not trading one single currency pair.

Instead we have a currency mean-reversion index.

Similar to the equity setup where mean-reversion on a single-stock would not have been as powerful, however in aggregate the signal becomes very strong for the index itself, the S&P500.

Looking at the correlation of this strategy with our equity strategy: **-5%!!** Driven primarily by the US debt downgrade shock in August of 2011, where currencies shocked the other way to equities.

And this is an indication that we might want to mix it up, and put these two together.

Adjusting for volatilities, we obtain:

With a Sharpe Ratio of 1.17

No that is really not too bad!

We’ve covered mean-reversion on currencies in this article.

And as we indicated at the start, trading currencies can provide a much tougher time. However, combining them with other assets provides great diversification.

Even more importantly, none of the methods we’ve tackled so far are ‘rocket-science.’

That’s not the point of trading.

The point of trading is to find something that provides juice and systematically extract it.

We’ve covered the equity portfolio of our Consistent Trading Portfolio.

Next up will be bonds.

Bonds are much more tricky to deal with, since they are finite maturity products, that pay coupons on a regular basis. Nowadays you can get useful data from bond ETFs, such the AGG, TLT, SHY, etc.

The biggest argument levelled at these ETFs is their short history, and the fact that they’ve been trading during one of the biggest bond bull markets.

Many say that now with rising rates we’ll see the end of their profitability and they could even be drag to include in a portfolio.

So, the next part of this series will look at putting together an index which we’ll calculate off available government interest rate data going back 70 years or so. And then we’ll have some fun looking at bond behavior and its contribution to our portfolio.

So, until next time,

Happy Trading.

If you have enjoyed this post follow me on Twitter and sign-up to my Newsletter for weekly updates on trading strategies and other market insights below!

The post Trading Mean Reversion in Currencies appeared first on FXMasterCourse.

]]>The post Equities Mean Reversion appeared first on FXMasterCourse.

]]>And as part of Building Consistently Profitable Trading Systems it forms a key component.

In this article we’ll present the final version of the mean-reversion system to form part of the trading toolbox, and the final portfolio.

It’s the Larry Connor’s RSI2 strategy. And it’s based on the two concepts we covered in Equities and Their Mean Reversion Habits:

- Looking for a series of down days
- Looking for reversion towards a short dated moving average

And as we said in previous articles, the twist we’ll add is by introducing Welles Wilder’s RSI indicator.

Recall that in Building Consistently Profitable Trading Systems the stated aim was to re-use well known systems that have worked in the past and keep on working. Re-inventing the wheel can be a waste of time.

The point of trading is to exercise discipline and really intervene when systems start to behave differently from their historic norm.

With that said let’s proceed.

From Equities and Their Mean Reversion Habits we saw that by combining two systems we obtained a solid performance. The first system required you to buy after two-down days in the SPY (the S&P 500 ETF). The second system required you to go long the SPY while you were below the 5 day moving average. Here is a P&L chart to refresh your memory:

We’ll add modifications to this system and boost the Sharpe ratio it had from 0.7 to close to 1.

The primary modification is to move away from a binary signal (two down days in a row) to a continuous signal, by utilizing Wilder’s Relative Strength Indicator (RSI).

The RSI indicator measures the strength between upward and downward moves in an asset. The logic goes that if there has been a strong move in one direction then we’re due for a correction in the opposite direction.

The actual calculation looks at the average of the upward moves versus the average of the downward moves via the relative strength (where we are looking at the sizes of the moves, ignoring their signs):

\(RS = \frac{\mathrm{Avg}(up moves)}{\mathrm{Avg}(down moves)}\)

Obviously this calculation is bounded below by zero, but unbounded above.

So Wilder created the RSI which simply caps the indicator at 100 on the upside:

\(RSI=100 – \frac{100}{(1+RS)}\)

The logic goes: as you have persistent up moves, the Relative Strength (RS) becomes large, and the RSI goes to 100. If you have persistent down moves, the RS goes to zero, and the RSI goes to zero as well.

The mean-reversion interpretation comes from the fact that we tend to go short as the RSI approaches 100, and we tend to go long as it approaches 0.

A good question to ask right now is what kind of distribution does this RSI have?

It turns out that the 2 day look-back is a special case. The majority of RSI readings in this case actually occur at the extremes: 0 and 100.

As the look-back window increases the distribution becomes more and more normally distributed, centered around 50. For Wilder’s default value of 14, the standard deviation is 10, which explains the choice of 30 and 70 as the lower and upper bounds for the RSI. They are two standard deviations away and represent 95% confidence intervals.

Now, back to the RSI(2).

One important point about financial time series is that they do have memory, and that memory tends to be very short lived. One / two time periods tends to be a good guess as to how long memory lasts in financial time series.

Hence our choice of RSI(2) (Note: go ahead and replicate these systems for the RSI(3), you should get similar results, and it’s a great exercise!).

The RSI(2)’s particular distribution looks like:

The cut-off values 0 and 100 prevent the tails from spilling past those bounds. Hence the bunching up at the ends.

Now, let’s apply it to the S&P 500.

There is actually quite a nice way to implement the RSI, using not just thresholds but the signal itself to position size.

You re-center the RSI around 50 and take positions equal and opposite in size to the RSI:

\(\mathrm{Posn}=-\frac{RSI-50}{100}\)

where I have divided by 100 to keep the position sizes in check. The look-back window for the RSI here is 2.

Applying this to the SP500 gives:

It works, but it’s quite choppy.

If you apply the RSI in the usual fashion, entering long / short positions when thresholds get crossed you get a similar picture. To be clear, the approach here is to only hold the S&P 500 for the following day once the thresholds get crossed. Short for high thresholds, and long for low thresholds of the RSI.

The thresholds we use are 20 for long entries and 80 for short entries.

The motivation for choosing these thresholds are that they are one standard deviation away from the mean value of the RSI (which is 50).

Of course holding only for the next day leaves a lot of money on the table.

This is where our 5-day moving average approach comes in (and it’s also Larry Connor’s exit strategy).

The idea here is to hold the position until the S&P 500 crosses the 5-day moving average.

If you’re long you wait for price to cross the 5-day moving average from below to above it.

And vice versa for a short position.

This approach leads to:

We can now use our understanding of momentum from the previous article to add that to the mix.

We only take on long positions in the direction of the long-term momentum, and short positions in the direction of short-term momentum.

We determine the direction of momentum by looking at the 200-day moving average. If price is above it, we take long positions, and if price is below it we take short positions.

The choice of 200 days here is to be in accord with Larry Connor’s original system. Which is not too far off the 252 business days in a year, corresponding to our 12-month momentum approach.

The resulting strategy is:

We chose 20 and 80 as thresholds before, based on the standard deviation argument of the RSI(2) distribution.

On top of that we also saw that restricting trading in the direction of the long-term trend improved the performance significantly.

But what if we experience a divergence that continues? Of course, the usual adage is to not average down losers. However, the whole point of contrarian trading is that the further away from the mean you are the more confident you will be that you will revert to it. Therefore, the only logical conclusion is to increase position size.

The way to implement this is to layer the same strategy on top of the current one, but with thresholds set further out. I.e. at 90/10. The means that at above 80 we go short one unit, and above 90 we go short a second unit. Similarly below 20 we go long one unit and below 10 we go long a second unit.

Combining these two systems smooths out our P&L even further:

The fun now is to combine our long-term momentum system with the short-term mean reversion system and see what happens.

Right off the bat the first thing to notice is that the short-term mean reversion strategy in essence increases positions in the direction of the long-term momentum when you have dips.

You are buying dips in up trends and selling rallies in down trends.

This is a well-known approach to trading. We have managed to quantify it here.

The question is exactly how to combine these strategies. A standard approach is that of taking the correlations of the various assets/systems and optimize with respect to some criterion, e.g. minimum variance, desired return etc. (i.e. classic Markowitz).

This is complicated, fraught with statistical noise, and hence continuous rebalancing of the portfolio.

A much more straightforward method is to simply state that all correlations are zero. And assign equal risk to all assets. Under the zero-correlation assumption it boils down to risk parity.

Though this method appears naive, it is a tried and tested method of many trading desks over the decades, and has proven quite robust (as you don’t have to estimate many statistical properties!).

As long as the strategies make money, it’s a great way to combine them. Especially if you have reason to believe that the strategies are uncorrelated. If they are, your performance will improve:

As before, let’s look at some of the trading performance measures.

RSI & Momentum | |
---|---|

Ann Ret | 11.1% |

Ann Vol | 12.4% |

Sharpe Ratio | 1.1 |

Max DrawDown | -20% |

This is indeed a significant improvement. Our Sharpe Ratio went from 0.7 to 1.1. This alone allows a big increase on our maximum optimal leverage.

Remember, a lower drawdown and higher Sharpe ratio, lead to better leverage conditions, and ultimately to faster and greater wealth growth.

Let’s just apply half-Kelly to this strategy. In this particular case that would be a five times leverage:

All we can say is, hold on to the seat of your pants!

Equities, equities, equities…

Why focus on them so much?

Because they are currently going up! Look at the charts. I always find it remarkable that people are quite willing to bang their heads against a wall, when there is an easy option staring them in the face!

Just in the last week we’ve nearly posted a 1% return on the S&P 500. And as I’ve said in the past, I’m sure a correction is somewhere round the corner. However, the markets will give you ample opportunity to move out of the way before it happens!

This was also true for 1987, using momentum measures over a variety of time horizons. The same will be true now.

This article finished the Equity bit of this series on building a consistently profitable strategy.

To recap:

- We’ve covered long-term momentum and seen it work over the last one and a half century
- We’ve covered short-term mean reversion, and granted, though it started working as of 1982, it still is going strong. No reason to abandon it.
- We saw how to combine these two to produce consistent results over the long-term

Of course, utilizing these ideas there are many more Equity assets we could explore. Such as the sector ETFs as well as international equity ETFs.

The performance will be similar within the same order of magnitude.

However, the key adage to trading is that you can’t and shouldn’t stick to one asset / system. You need to diversify.

With that in mind…

In next week’s article it’ll be back to currencies, and how they mean-revert.

The real fascinating stuff about the S&P 500 index is that it exhibits momentum and mean-reversion (of course over different time-scales).

With currencies this isn’t necessarily so. And to get to the mean-reverting juice you have to choose the right pond to fish in. Sticking firmly to the majors and their crosses we’ll construct a portfolio that has seen some consistent behavior over the last 20 and more years.

So, until next time,

Happy Trading.

If you have enjoyed this post follow me on Twitter and sign-up to my Newsletter for weekly updates on trading strategies and other market insights below!

The post Equities Mean Reversion appeared first on FXMasterCourse.

]]>The post Equities Mean Reversion and Market Regimes appeared first on FXMasterCourse.

]]>In the previous article we combined the idea of looking at two consecutive down-days combined with buying the S&P 500 while it was below its five day moving average.

A question that stands out: why does it work so well? And, will it ever stop?

The answer to this question lies at the heart of developing good trading strategies.

Ultimately a trading strategy is a procedure that generates buy/sell signals from the information made available to it.

The underlying assumption therefore is that markets are driven by the factors we are trying to exploit.

So a trading strategy ultimately means determining the factors that drive the market, determining how strong they are and if they are persistent. And then finding a way of overcoming the market noise to get the most value out of our trades.

Some well-known factors are: momentum, mean-reversion, economic fundamentals.

You’ll probably be familiar with the fact that choppy markets are anathema to trend-following.

And of course overly trendy markets are bad for mean-reversion.

Economically motivated strategies such as macro strategies assume that markets over time converge to some economically implied value for the asset.

But how can we determine if the factors we wish to trade are actually present?

For the purpose of this article series, as in the previous articles, we’ll focus on the S&P 500 whilst answering these questions.

How can we detect market regimes? Usually the simplest methods tend to be best.

The ones we want to focus on in this article are mean-reversion and by association, momentum; one being the mirror image of the other.

The way we usually understand mean-reversion is as a tendency to move counter to the direction of the most recent moves. Usually off the back of an overextension.

Momentum on the other hand is nothing more than a continuation move.

So what would be a really naïve strategy to exploit either of these behaviours?

In the case of mean-reversion we can simply trade in the opposite direction to yesterday’s move:

\(\mathrm{\mathrm{Position}}_{today}=-\mathrm{sign}(\mathrm{Return}_{\mathrm{yesterday}})\)

In the case of momentum we revert the sign on the right as we are trading in the direction of yesterday’s move

Not that difficult!

So let’s check it, as far back as we can.

__Market Regimes in the Dow Jones Industrial Index and the S&P 500__

The two data series most easily accessible and going back far enough are the Dow Jones Industrial Index going back to 1900 and the S&P 500 for which we can easily obtain data back to 1950. Both of these sources have daily closing data.

Applying the momentum strategy to both these indices we obtain (where we are treating returns as additive):

and

Both these charts exhibit some very fascinating and consistent behaviour (which is the reason we chose to focus on momentum first, rather than run the mean-reversion counterpart).

Most of the time we spent in a trending market. You can see this by the incredible performance of this naïve strategy. (Note: we haven’t taken any commission / slippage into account here!)

There were times when the trendiness switched sides, and we became strongly mean-reverting (as can be seen in the loss making periods of this naïve momentum strategy).

These periods coincided with the post-1929 era and the post-2000 era. Both experienced big crashes.

So, how does that influence our expectations about mean reversion?

To answer this question let’s apply the two systems we described in the previous article to both these indices and see how they performed.

We see that prior to 1982, the performance was actually a straight line down.

So mean-reversion beware! Even if the bonanza has lasted the last 35 years, over the real long-term it didn’t fare too well!

** **

As we saw, the P&L on naïve strategies is quite an efficient way of establishing the regime we are in.

Is there another way?

Yes: Autocorrelation. Autocorrelation measures the tendency of a market to follow through on the previous day’s move. In excel we simply use the CORREL function where the input is the same return series, but offset by one cell from itself.

Let’s apply the 1-day autocorrelation (using the past year’s data) on the S&P 500 return since 1950 and overlay a two year moving average on top of it to smooth out the oscillations:

We have been firmly in a mean-reverting regime since the early 80s, as can be seen from the autocorrelation starting to poke below zero and then firmly staying in that territory.

Many things could have changed the market dynamic; one thing that does stand out is that S&P 500 futures started trading in 1982 on the CME, though I admit this might a tenuous relationship (for instance no index futures were introduced shortly after the 1929 crash).

Another explanation might be that the shocks markets experience during significant crashes tend to drive a change in behaviour of market participants from trendiness to mean-reversion.

It is always relevant to understand the market regime you are in.

The regime will ultimately determine the kind of strategy you can apply.

For instance post 2013 EURUSD intraday ranges collapsed, and intraday strategies were at a big disadvantage.

In the case above we can see that mean-reversion did not work well in trending markets.

It’s therefore not just necessary to design indicators that have some form of predictive power. It’s more important to understand the underlying statistical tools you can use to obtain information about the characteristics of the market. As well as the properties of these measures.

In essence you are building a market scanner, that will be able to tell you which strategies to apply.

What’s highly interesting in the case of the equity market analysis above, is the persistence of the underlying behaviour, be it mean-reversion or momentum. We are talking decades.

A good systematic trader (aka market scientist) also works the other way. Once he thinks he has found a statistical feature that provides juice he creates a lab. In our particular case it would be great to see if the autocorrelation feature is the true driver behind our 2 down day system.

All we need to do is create a time series that has those features. In essence a controlled version of out S&P 500 index.

Below is the Python code to do this. The parameters we are using are estimated from the S&P 500. We generate the autocorrelation by simulating an AR(1) process from gaussian random variables. Here is a result from a sample:

import pandas as pd import numpy as np import matplotlib.pyplot as plt r = np.random.normal(0.0, 1.0, 6250) ac1 = -0.064 ac2 = -0.00453 mu = 0.0003515 std = 0.011385 df = pd.DataFrame({'rand': r}) df['rand_ac'] = df['rand'] + ac1 * df['rand'].shift(1) # + ac2 * df['rand'].shift(2) # --- uncomment df['ret_sim'] = mu + std * df['rand_ac'] df['px'] = (1 + df['ret_sim']).cumprod() df['sig'] = (df['ret_sim'] < 0) & (df['ret_sim'].shift(1) < 0) df['sys'] = (1+df['sig'].shift(1) * df['ret_sim']).cumprod() plt.plot(df.index, df['px'], hold=False, label='Simulated Price') plt.plot(df.index, df['sys'], hold=True, label='Two Down Day') plt.grid() plt.legend()

[*Note**: to keep the article from over-running I’ve cheated here. A two down day strategy really requires an AR(2) process. And indeed if you work out the autocorrelation lagged by two days for the S&P 500 you see exactly that. Uncomment the code to run these controlled experiments. And if you’re up to it, check out that the down 2 day actually doesn’t do that well for a simple AR(1) process! Autocorrelation is more subtle than meets the eye!]*

As expected the P&L is driven by the statistical feature we baked into the model.

__Currency Markets__

In currency mean-reversion is slightly more subtle. Using the pattern based approach (i.e. the 2 down day) is not necessarily the best method of extracting value. There is a lot of underlying noise in the currency pairs.

However, the 5-day moving average acts as a great smoother.

You also have to find the right pond to fish in. USDJPY is an explosive pair and even to this day quite trendy.

A great mean-reverting pair is EURSEK. Have a look at the long term chart:

And applying the 5-day moving average approach from the previous article produces following result:

This article addressed the concerns as well as the criticisms that are levelled at the types of mean-reversion strategies we have been looking at:

- They haven’t always worked
- They’re over fit

In actuality the systems are so simple, that the second can’t really be levelled at them. The first point however is valid: and a long back test shows that they didn’t always work.

But that’s the point of the saying “the only constant thing about markets is that markets will always change.”

You have to understand what drives your system to ensure that it will continue to function. If the underlying cause changes or disappears, so will your system.

Here we identified a statistical feature of the equity market that does contribute to the performance as we saw from our “lab” experiments.

Today’s article acted as a general disclaimer: these systems work; now. They didn’t always work, but, we’ve done our darndest to nail down when they might fail and how to detect if the market conditions are right.

With this setup we are ready to move on to a twist on the mean-reversion combination we’ve been covering. And then add to that the Equity momentum strategies. That’ll be portfolio composition for you!

So, until next time,

Happy Trading.

If you have enjoyed this post follow me on Twitter and sign-up to my Newsletter for weekly updates on trading strategies and other market insights below!

The post Equities Mean Reversion and Market Regimes appeared first on FXMasterCourse.

]]>The post How to Implement Leverage Using Kelly Betting appeared first on FXMasterCourse.

]]>“How do you deduce leverage from your backtests?”

“How do you actually implement leverage in your trading?”

“How do you calculate position size?”

“How often do you rebalance?”

So, to keep this series as hands on and close to reality as possible, this article focuses on the practical aspects of implementing leverage on your account (and no, the margin your Broker indicates, such as 1:400 doesn’t count).

In detail for this article:

- How do the results of the backtests translate to actual position sizes?
- How does that translate into day-to-day trading?
- What kind of money-management type is Kelly betting?
- How do you work out position sizes with your MT4 broker?

The take away message is that leverage in and of itself is a very straightforward concept.

The difficulty arises when you have to actually work out the leverage from your systems testing and then translate it into actual position sizes on your trading account.

As you saw in the previous articles, all backtests ultimately reduced to percentage returns.

In essence we had an asset, \(A_i\) and we looked at its returns over a period \(R_i:=\frac{A_i}{A_{i-1}}-1\)

Especially for equities this simplifies the view on risk: as the SPY (recall this is the S&P 500 ETF) increases in price, its swings will be much larger in terms of points, but will remain of comparable size when looked at in terms of percentage risk.

Now, let’s say that you have *C* dollars in your account. A leverage one position would imply that you use your full cash amount to purchase *N* units of the asset at a price *P*.

Of course there will be rounding errors, since most of the time you can’t buy fractions of the assets, and \(\frac{C}{P}\) isn’t a whole number. But we’ll gloss over these details here!

With this leverage one position any percentage change in the asset will equate to an equal percentage change in your account value.

This is your base case scenario.

Now, recall that the way we looked at leverage, was as a multiplicative factor on the asset returns!

Meaning that when we set our leverage to two, this actually translated to:

\(R_i \longrightarrow 2 \times R_i\)

And of course to achieve that it means that at the start of the period we had to purchase twice as many units as we did with our original capital, i.e. we must purchase \(2 \times N\) units!

That’s pretty straightforward, no?

But the next time period, after the asset has moved, you have to keep on your toes, since we’ll be facing some market trickery!

To figure out what happens in the next time period after the market has moved, let’s work out some explicit numbers.

Let’s say that we’re going to use a leverage two position. Our asset price is initially at $100. And it moves up 10%.

So in essence to have a leverage two position, we’re going to lay out $200 of cash and purchase two units of the asset. (Where the extra money came from is a question of margin, and we’ll get to that later).

So we started out with $100, bought two units of the asset, which moved up 10%. So we made $20 of profit.

Now here is the trick question. Is your leverage still \(2\times\)?

Think about it before you move ahead.

The answer is ….

…. NO!

You now have $120 in the kitty and the value of your holdings is $220.

If you work out the maths your leverage is now \(\frac{$220}{$120}=1.83\times\).

Your leverage just decreased. This is really important.

This would not have happened had you had a leverage 1 position.

So if you want to maintain a constant leverage, which is of course what we calculated in the previous articles, there is only one thing left to do.

You gotta buy more!

How much more is easy to figure out. Your total holding has to equal twice your cash, which in this case would be $240. So you have to buy an extra $20 worth of assets. (Let’s ignore the issue of fractional asset holdings here for the time being).

Now let’s look at the scenario where the asset price decreases by 10%. You again start out with $100, and you have a leverage of 2 times which means you just purchased $200 worth of the asset.

After the 10% drop in the asset price you lose 20% of your holdings (as expected from a leverage two position), which results in your net worth being $80. However your holdings are now equal to $180.

So what has happened to your leverage?

It’s actually increased.

Your leverage is now \(\frac{$180}{$80}=2.25 \times\).

So it’s obvious what you have to do for the next trading period: you have to dump some of your holdings to get back to the leverage that you were targeting. In this case you have to get rid of $20 of the asset.

The above section is really important!

You see, most people think of leverage as being something constant that they don’t have to worry about once their position size is set.

That’s not quite true.

The argument goes: your leverage is variable, since it’s a multiplicative concept, however, your P&L changes are additive. This makes a whole bunch of difference.

The end-result: keeping a constant leverage (which is some fraction of your Kelly criterion as we saw in previous articles), requires you to constantly re-balance your portfolio.

But more than that: when you make money, Kelly forces you to increase your position size. When you lose money, Kelly forces you to reduce your position size.

Kelly betting in essence is an anti-martingale strategy, very much in line with what trend-followers apply in their trading. As the markets go in their favour, they pile in and hog out.

Recall Stanley Druckenmiller’s quote: “It takes courage to be a pig. It takes courage to ride a profit with huge leverage.”

To translate form capital in your MT4 (or MT5) brokerage account to lot size is now the final missing piece of the puzzle.

It’s what makes everything real.

To be clear, the calculation presented below applies to any brokerage account. And we’ll see how margin and ultimately the advertised broker leverage comes into it.

For this article we’ll use a broker who has following specifications for the S&P 500 index:

The important numbers for us are

- Contract size, which in this case is: 100

What this tells us is that for a 1 lot trade, in the parlance of the broker, a one point move in the index is equal to 100 units of the base currency, which in this case is USD.

So quick, if I want to purchase one unit of the index at a price of 2,564 (the current price), what would my lot size with this broker be?

Well, it would have to be one hundredth! Or \(\frac{\mathrm{Lot Size}}{\mathrm{Contract Size}}=\frac{1.0}{100}=0.01\), which is also the smallest unit of volume tradable for this asset.

So let’s say we have $10,000 in our account, and we would like to leverage or holding to three times. What would the lot size be?

Here it is:

\( 0.01 \times \mathrm{Lev} \times \frac{Capital}{Price} = 0.01 \times 3 \times \frac{10,000}{2564} = 0.12\)

And you can see as your capital changes and the price changes so will your position size.

What will be your margin requirement be for this position?

Well, this is where the 1:400 advertised margin from your broker comes in. If you have $30,000 worth of SP500, one four-hundredth of this a requirement of $75. The $30,000 comes from using three times leverage on your $10,00 capital.

This small margin requirement is quite phenomenal.

If you look at the CME where the actual futures are traded, the marign requirement is 3.5%, which at this moment in time for one contract is \( 2564 \times 50 \times 3.5\% = 4,500\) dollars. We have used the fact that one point on the index is worth $50 of P&L.

Now of course such a MT4 broker margin means that theoretically you could leverage yourself up to 400 times. But that’s idiotic, and not what you would do in the first place.

The whole advantage of such margins is that in essence you are trading at almost zero funding cost. There are some caveats, and you will see that in this broker example both short and long position cost you, via the swap long and short. However, there are brokers that CFD the future and not the underlying cash index. Since there the funding cost is baked into the futures contract already, holding the CFD contract incurs no funding cost and is in essence at zero cost to you.

In this article we took a step back and looked at the practicality of what it means to work out your position size given the broker specifications for the underlying contract.

The calculation for your position size is straightforward.

However, the key concept, which rarely gets mentioned, is that true Kelly betting is a statement about constant leverage, since this is the assumption underlying the optimization equation.

Hence, to truly Kelly bet you will be actively turning you portfolio over, as you constantly try to keep the portfolio leverage close to the calculated Kelly criterion.

If you have followed this far, you probably have following question now:

- Given that my Capital fluctuates every day should I rebalance everyday??
**Or**should I only adjust trade sizes on the new trades that I put on.

To maintain your sanity I’d advocate the latter (which I also practice).

Also, to constantly rebalance your portfolio will ultimately result in higher transaction costs, which will erode any benefit from strictly adhering to the Kelly mechanism.

What is really nice about these results is that they conceptually tie together: we’ve been taught to pile in when we’ve got something good going for us, and the maths, in terms of optimal value extraction, points to exactly that.

As Hannibal Smith from the A-Team says: “I love it when a plan comes together!”

Next time we’ll return to improving our mean-reversion approach from last time, by looking at some of the favourite indicators. The end result will be pretty impressive.

And equipped with our current knowledge of leverage and its implementation we’ll look at properly combining the various equity strategies, before moving on to bonds.

So, until next time,

Happy Trading.

__Twitter__ and sign-up to my Newsletter for weekly updates on trading strategies and other market insights below!

The post How to Implement Leverage Using Kelly Betting appeared first on FXMasterCourse.

]]>The post Equities and Their Mean Reversion Habits appeared first on FXMasterCourse.

]]>So, here’s the deal. We’re going to keep it simple, just like in the previous three posts, and start from the ground up. Over the following series we’ll culminate in a simple, straightforward (and well known) system that still works.

In detail for this article:

- What do we mean by mean-reversion and how can we measure it?
- What are some natural methods to trade this?
- We’ll look at the results from these naïve setups!

Be fore-warned, there won’t be any rinky-dink magic marker indicator at play here. It’s actually really easy to set up. So if you think only magic grails will do it for you, you gotta move one.

Also, mean-reversion doesn’t exist only in equities, but in other asset classes as well. We’ll get to those topic in the follow-up articles. Those will also include the Python code (and spreadsheets) to go along with these examples.

Let’s start out with some basic stats.

You see, any time-series (that is a price-series in our trading parlance), has several basic properties (which are relevant to our discussion):

- Drift (aka mean)
- Swing-around (aka standard deviation)
- Bias towards negative or positive outcomes (skew)
- Dependency upon previous returns (auto-correlation)

The first are known as the first three moments (usually expressed as \(\mathbb{E}X^{1,2,3}\)), and tell you about the likelihood of a day’s return.

The last one, the autocorrelation gives you some forecasting power, as it tells you on average what happens tomorrow given today’s price behaviour. The sign here is important. If the auto-correlation is negative it means that if we had an up-day, it’s more likely we’ll have a down-day next.

To figure out if we have some sort of mean-reversion going on, we’re also going introduce time in our equation.

In particular different time frequencies. Remember Alexander Elder’s Triple Screen Trading System? It advocated looking at various time-frames to identify the asset’s behaviour.

Well, we’re going to do exactly focusing on daily, weekly, and monthly equity returns.

And to keep the article to the point: by equity I mean the S&P 500 market.

So here are the stats for the Daily, Weekly, and Monthly returns of the S&P 500:

Daily | Weekly | Monthly | |
---|---|---|---|

Mean | 10.0% | 10.0% | 10.0% |

StDev | 17.8% | 16.4% | 14.2% |

Skew | 0.10 | -0.6 | -0.7 |

Auto Corre | -6.3% | -8.5% | 6.3% |

We see that for monthly returns the auto-correlation is positive. And this is exactly what we exploited in the previous articles.

For Weekly and Daily returns we have negative auto-correlation which indicates that returns tend to want to go the opposite way.

So over the short time-horizon we can expect some form of whip-sawing.

What is definitely important to note is that the whip-sawing as measured over the various timescales isn’t the same. The standard-deviation actually becomes smaller over longer time horizons. This is an example of a Variance-Ratio test applied to a price-sers.

This result indicates that we expect our price-series to mean-revert, as the shorter time horizon swings need to be constrained strongly to give a lower volatility over longer time-horizons.

Furthermore, on the dailies, we see that the skew is positive. What this means for the case we are investigating is interesting: only on the daily returns do our daily returns actually overshoot the down days. If we look at the max / min of the daily, weekly, monthly returns we get:

Daily | Weekly | Monthly | |
---|---|---|---|

Min Return | -10% | -20% | -17% |

Max Return | 15% | 13% | 11% |

So the stats imply that over short time horizons we expect returns to go against the previous direction, which ultimately is the essence of mean-reversion. And we should focus on the dailies, where a positive skew, a positive drift will add a double whammy after we experience dips.

This is in accordance with an important observartion for our sample period: the equity markets were strongly upward trending (1993 to 2017). And as we saw previously this is a phenomenon that goes back even further. It’s important to note, because we can ex-ante expect long positions to outperform short positions!

Given the picture we’ve painted above here are two ways that immediately come to mind if you want to trade mean-reversion:

- If the market has been going in one direction, go the other way
- Trade in the opposite direction to the market’s short term directional trend.

We’re going to implement these approaches on daily closes. And for these two cases, we’ll focus on only trading until the close of the next day.

Nothing revolutionary. However, you immediately outperform the equity market by a wide margin! Actually on a par with some of the biggest money managers and hedge funds out there.

In detail:

__Case 1:__ If the market has been going down for N straight days, buy at the close and hold for one day.

It’s pretty naïve, but we are not too concerned right now with being sophisticated.

In-line with our expectations above, going short really only helped throughout the 2008 collapse. So, we’ll scrap that side of the equation.

We’ll also focus on N = 1 for the time being. Let’s not give anybody the chance to claim I’ve been data snooping! (I have, but the results are stable).

__Case 2:__ If the market is below its 5-day moving average, buy on the close and hold for one day.

Again, we’ll drop the short side of the equation.

The reason we chose 5-days is because it fits the fact that we see mean-reversion already kick in over the spane of a week: look at the compression of volatility over that period.

** **

__Case 1: Buying after a down day__

You might say, “no-way,” you’re making less!

But hang-on. Don’t you see that your draw-downs are lower, and the equity curve is smoother? Let’s measure that:

Down Day | S&P 500 | |
---|---|---|

Ann. Returns | 8.7% | 10.7% |

Ann. Volatility | 13.8% | 18.4% |

Sharpe Ratio | 0.63 | 0.58 |

Max D/D | -31% | -55% |

And now let’s take on a similar risk to the S&P 500 on our trading strategy.

Specifically we’ll just match the drawdown!

This is a CAGR of 27%. Certainly a good return. You might squabble over the Sharpe Ratio not being close enough to 1 but we’ll deal with that later.

__Case 2: below the 5-day moving average__

We get a similar performance as for Case 1. Again we can list out the stats:

Down Day | S&P 500 | |
---|---|---|

Ann. Returns | 9.6% | 10.7% |

Ann. Volatility | 14.3% | 18.4% |

Sharpe Ratio | 0.67 | 0.58 |

Max D/D | -33% | -55% |

And again we can scale up to get the same risk as the S&P 500 as measured in terms of its drawdown:

For Case 2 we also hit it out of the ball park with a 27% return on an annualized basis!

We can now rightly ask what happens if we combine the two concepts? That is, buy after a down day, and close out once we hit the 5 day moving average (or cross above it).

The rationale? *Mean-reversion complete*.

We buy after we drop, and we close out after we hit the weekly mean. I.e. we revert to the mean in the true and proper sense of the word.

It turns out that by keeping the memory length to only one day as a decider for our buying strategy is too short, and gets swamped by the moving average overlay. We therefore need to extend it to the next logical step: buy when we have experienced a two day drop.

On an unleveraged basis we managed to improve performance. Here are the stats for this approach:

Full Mean-Reversion | S&P 500 | |
---|---|---|

Ann. Returns | 9.1% | 10.7% |

Ann. Volatility | 13.0% | 18.4% |

Sharpe Ratio | 0.7 | 0.58 |

Max D/D | 24% | -55% |

We have pushed the Sharpe up to 0.7. But what’s remarkable now is that our drawdown has decreased to 24%. So let’s risk this up so that we match the S&P 500 in terms of drawdowns:

We now get a 34% CAGR. Trust me, this is indeed something to write home about!

** **

In this article we covered set some of the foundational details of developing trading systems. In particular we looked at mean-reversion:

- How to measure and define it
- Two naïve approaches to trading it
- Combining the two ideas to hit the definition of reverting to the mean
- Seeing that the end result puts you in the top league of hedge fund managers

Do you still believe that trading is difficult?

Imagine combining this strategy with our momentum strategy, what would happen then…?

__See You Next Time…__

Next time we’ll take a stab at improving our mean-reversion approach by looking at some of the favourite indicators out there in combination with our rule-set above.

The end result is pretty impressive, as it extends the Sharpe Ratio we’re encountering from 0.7 to 1.0, and the resulting performance is truly astounding.

Surprisingly this particular system has been well-known for some time, and I’ve traded it for several years consistently. I’m highlighting this in case people start to moan about curve fitting and data snooping.

So, try to replicate these calculations, and see if you can repeat the performance.

Until next time,

Happy Trading.

The post Equities and Their Mean Reversion Habits appeared first on FXMasterCourse.

]]>The post Dangers of Backtesting, Over-Leverage and the Need for a Protective Stop appeared first on FXMasterCourse.

]]>A shout out to Peter who raised both these points on the previous article in the series: Trading Numbers

So, what are the two issues we’ll address in this week’s article:

- Look ahead bias, and is it really that bad?
- Kelly is always touted as optimal. Is it really that optimal?

And to all those who don’t like spoilers: (2) will be covered in more detail later in this article series, so close your eyes; but following Peter’s comments, I couldn’t help include some detailed analysis here, I hadn’t really considered earlier.

I hear you asking, “What’s this look under the bed bias??”

Well, remember in Trading Numbers, we used momentum to setup a strategy that easily outperformed the S&P500.

Recapping: on the last trading day of the month you looked back over the last year. If the S&P500 had finished up, you bought, otherwise you were flat. Nice and simple.

Now assume that you were a bit sloppy implementing this in your spreadsheet, and you let a Look Ahead bias creep in. Let’s see what this bias could have led us to believe:

Wow!

That’s pretty impressive.

Recall what it really looked like, however:

That’s a bummer. We overstated performance by 100%! What went wrong?

For anybody, who’s implemented anything in Excel, you’ll know how easy it is to get references mixed up. In this particular case the Look Ahead bias entered by trading the 12^{th} month of our lookback period.

I.e. rather than trading the 13^{th} month, using the prior 12 months’ information, we traded the last month of the 12-month lookback period, even though we already used that month to form our trading decision. It’s like assuming you have a crystal ball!

The really insidious thing here is how 12-month momentum and 1-month momentum are so strongly correlated! You would have assumed that it wouldn’t make that much difference!

Now obviously a situation like this can only arise when you backtest. Unfortunately, you only go live after you have a good backtesting result, and so it’s not surprising that, given a Look Ahead bias makes backtests look so nice, this error keeps on rearing its head.

Either check your tests, or forward walk your system to see that you are indeed testing realistic rules.

So how did we fall prey to the Look Ahead bias in the previous article, and what is our saving grace.

As was pointed out, we risk adjusted our 12-month momentum strategy. Here it is again:

And to do that, we had to measure the risk of the S&P 500 and that of the Momentum strategy and scale up the Momentum strategy appropriately.

And if you recall from the previous article, we did that by measuring the standard deviation of both strategies.

But HANG ON! How can we do that if in 1994, we have no clue how these strategies will pan out over the next 23 years?!

That’s where we got clonked.

The scaling factor turned out to be 1.3x, based upon these “Forward Looking” risk measures (which were nothing more than the standard deviations of the P&L streams of either strategy).

A possible solution was to use an expanding window for our risk measure. Meaning at each time we measure the risk from that point in time all the way back to 1994 (the start of our simulated trading).

This actually ends up giving us a much lower risk multiplier, and hence a much lower performance for the risk adjusted momentum strategy.

Indeed, an issue.

There is, however, a saving grace for us in all this, and it actually gives us even more confidence in the momentum strategy.

Our saving grace is that the stock markets didn’t just magically appear in 1994!

If you recall from the first article in this series: Building Profitable Trading Systems, we had data (albeit synthetic) going all the way back to 1871.

So, let’s try this. Let’s estimate the relative risk from 1871 until 1994 for both the S&P 500 as well as its momentum filtered counterpart.

It so magically turns out that the relationship of 1.3x is stable! The risks from 1871 until 1994 were nearly identical as for the period 1994 to 2017!

Now that is remarkable indeed.

It means two things:

- Our initial analysis still stands
- Going forward we can rest assured that we don’t have to fiddle too much with our risk multiplier, since it has been stable at the same value (at least to O(0.1) ) for the last 150 years.

What else does this do for us?

It underscores the stability of our approach. Going back to gaining confidence from statistical measures, it implies that structurally markets have stayed very similar over modern times. And this gives us confidence to proceed with this strategy.

This leads nicely to the second point that was raised.

What is the optimal leverage I should use? It turns out that simply risk-adjusting the momentum strategy does leave a lot of money on the table.

Accepted wisdom recommends using a leverage factor equal to the Kelly criterion.

This Kelly factor is usually evaluated using statistical properties of the return series. In particular:

\( \lambda = \frac{\mu}{\sigma^2} \)

Where \(\mu\) and \(\sigma\) are the average rate of return and the standard deviation of our momentum strategy.

There are some caveats here. Naively plugging our mean and standard deviation estimate using this formula gives an optimal leverage factor of 8.8.

This leads to:

which is a cataclysmic result.

And furthermore, how on earth is this possible?

The simple answer: Over-leverage.

Let’s define Over-Leverage: the naïve assumption that we have all available, all possible, information at our disposal, and we have the over-powering desire to ride the ragged edge of disaster.

Obviously, this is a fallacious assumption and attitude. (You’ll see towards the end how this leads to the notion of a Stop Loss).

So how could we rectify our example above?

Let’s wind the clock back a bit, and work out Kelly from first principles.

Principles:

- The returns of our asset / trading strategy are normally distributed.
- We can safely ignore any risk terms coming from higher-order moments of the normal distribution

The way these assumption feed into Kelly is visible from the structure of the formula: it only includes the mean and the standard deviation of the return distribution.

So, this leads us to the conclusion that maybe our Momentum Strategy isn’t as normal as we might assume, and might have riskier higher order moments than a normal distribution.

Let’s check this.

Kurtosis, \(\kappa=1.8\), and skweness, \(\gamma_1=-0.25\). It’s got fat tails, which isn’t surprising for a momentum strategy, and interestingly enough a negative skew. Now, this is interesting because on the one hand you’d expect positive skew for momentum strategies (viz. the MAN AHL article: Positive Point of Skew), however, for stocks skewness of the strategy tends to be negative (cf this great article Skewness Enhancement), indicating that you can fall off a cliff.

So how do we deal with this?

Let’s go back to the derivation of Kelly.

If our wealth process evolves like \({\displaystyle V=V_0\prod_i{(1+\lambda X_i)}}\), where \(\lambda\) is our leverage, and \(X_i\) is the return over a time period, we can find the optimal leverage, the Kelly leverage, by optimizing the expected growth rate with regards to our leverage factor.

Writing out the expected growth rate:

\({\displaystyle g(\lambda)=\mathbb{E}\left(\log\frac{V}{V_0}\right)=\sum_i \mathbb{E} \log(1+\lambda X_i) }\)

and taking into account that our returns are identically distributed over all time-steps (iid), we can Taylor expand \(g(\lambda)\) as:

\(g(\lambda) = \lambda \mathbb{E} X – \frac{1}{2}\lambda^2 \mathbb{E}X^2 + \frac{1}{3}\lambda^3 \mathbb{E}X^3 – \frac{1}{4} \lambda^4 \mathbb{E} X^4\)

The optimization means taking the derivative of \(g(\lambda)\) with respect to \(\lambda\), and setting it equal to zero:

\(g'(\lambda)=\lambda^3\mathbb{E}X^4 – \lambda^2\mathbb{E}X^3 + \lambda\mathbb{E}X^2 – \mathbb{E}X = 0\)

In the case where we assume kurtosis and skew to be zero the Kelly-leverage \(\lambda\) ends up being our usual suspect.

However, we obtain a cubic equation if we include the higher order moments.

Thank goodness for the Italians having found solutions for this in 16^{th} Century (del Ferro, Tartaglia, Cardano, and Bombelli).

Working out the four moments for our case of the momentum strategy and using the algebraic solution for a cubic, we obtain an optimal leverage factor of 7.35.

Now this looks good, it’s lower than before, and it seems to have noticed our fat tails and negative skew. But is it good enough??

NO!

We still fall off a cliff. And I don’t even have to look at a chart.

Do you want to know why?

Because in 1998 August, the Russians went boom, and the stock market took a big nose dive.

Our momentum portfolio lost 14% that month. And 14% x 7.35 is bigger than 100%, meaning with this leverage we would have lost it all.

What went wrong with our super-duper maths?

Simple, that event was a massive outlier. The next biggest loss for the momentum strategy is at 7%. This means that the kurtosis is even bigger than we estimated from our sample.

So what solutions do we have?

There are two possibilities in our case:

- We cheat! Meaning that since our strategy derives from the underlying market, why not use the skew and the kurtosis of the S&P 500? This would allow us to benefit from the increased returns and lower volatility of the momentum strategy, but still take into account the potential for big losses from the S&P500!
- We follow the madding crowd and use half-Kelly instead.

For option (1) we obtain a leverage of 6.0, which is not too far from the optimal leverage at 6.32 (if you numerically fiddle with the numbers). For option (2) we’d obtain 4.4.

What would the difference in performance be? Option (1) yields a 11,800x return, and option (2) a return of 3,900x. I would say it’s ball park similar!

Forgetting for the time being the ludicrously high numbers (not that they are ridiculous), the real question arises: even if we used the S&P 500’s fatter tails, we haven’t really guarded against a cataclysmic event in the future: we simply don’t have a crystal ball!

Coming back full circle, this is where ultimately the protective stop comes in.

The message is as always, the old one: you can’t forecast the future, and hence you have to put a stop in to protect yourself.

However, here is where it gets more refined.

The stop I’m talking about is one that protects your capital from *disaster.* I’m not talking trailing stops, or stops set at some arbitrary point, where a trade signal has been negated. The cows haven’t come home yet on the subject of where the ideal trading stop is.

However, with respect to disaster recovery, it’s clear you need them. The position depends on your risk appetite. There are people out there who are quite happy to stomach a 90% loss. Do you belong in that camp?

In this article we covered some foundational details of developing trading systems. In particular, the dangers of backtesting and over-leverage:

- The Look Ahead bias can creep into your analysis in the most devious of ways. Always be on the look-out, especially if your equity curve is too much of a straight line in your tests
- Over-leverage is a killer when you least need it: in the worst-case scenario. It’s the reason places like LTCM, Amaranth, Peloton had to book the losses they did (as well as Howie Hubler at Morgan Stanley, and with him the rest of the US housing market). So, decide a level at which you will get out, just for the sake of keeping alive (as long as it’s not at -100%!)

In addition, we had some numbers excursion that have been quite fun, and have led to some better ways of calculating the usual leverage ratios touted out there.

If you want to incorporate these, here is the extension of the previous Python code:

import matplotlib.pyplot as plt import numpy as np import math from pandas_datareader import data as pdr import fix_yahoo_finance as yf yf.pdr_override() def cubic(a,b,c,d): d0 = b**2 - 3*a*c d1 = 2*(b**3) - 9*a*b*c + 27*(a**2) * d C = ( (d1 + math.sqrt(d1**2 - 4*(d0**3)))/2 ) ** (1/3) res = -1/(3*a) * (b + C + d0/C) return res def optimal_leverage(spy_ret, mom_ret): a1 = (spy_ret**4).mean() b1 = (spy_ret**3).mean() a2 = (mom_ret**4).mean() b2 = (mom_ret**3).mean() c = (mom_ret**2).mean() d = (mom_ret**1).mean() kelly = d/c lev_mom = cubic(-a2,b2,-c,d) lev_mom_spy = cubic(-a1,b1,-c,d) return (kelly, lev_mom, lev_mom_spy) if __name__=="__main__": data = pdr.get_data_yahoo('SPY', start='1990-01-01', end='2017-10-02', interval="1mo") c = data[["Adj Close"]] c["spy"] = c["Adj Close"] / c.ix[0,"Adj Close"] c["rets"]=c["spy"]/c["spy"].shift(1)-1 c["flag"]=np.where(c["Adj Close"]>c["Adj Close"].shift(12),1,0) c["mom_ret"] = c["flag"].shift(1) * c["rets"] (kelly, lev_mom, lev_mom_spy) = optimal_leverage(c["rets"], c["mom_ret"]) print("Kelly: {}, Optimal leverage for momentum strategy: {}, " \ "Optimal leverage for momentum strategy using SPY " \ "kurtosis and skew{}".format(str(kelly),str(lev_mom),str(lev_mom_spy))) std_spy = c["rets"].std() std_mom = c["mom_ret"].std() fac = std_spy / std_mom c["mom"] = (1+c["mom_ret"]).cumprod() c["mom_lev"] = (1 + c["mom_ret"] * fac).cumprod() plt.plot(c.index, c["spy"], label="spy") plt.hold(True) plt.plot(c.index, c["mom"], label="spy 12m - mom") plt.plot(c.index, c["mom_lev"], label="spy 12m lev") plt.grid() plt.title("SPY vs SPY 12 Month Momentum vs SPY Momentum Leveraged", \ fontdict={'fontsize':24, 'fontweight':'bold'}) plt.legend(prop={'size':16}) plt.show()

Next time round, we’ll be continuing with a technical variant of mean-reversion for equities which has proven profitable over the last 25 years, and which doesn’t let up. (Double promise! No detour foreseen). In particular, we’ll look at various ways of understanding market regimes.

I’ll also utilize our analysis on Kelly betting to give you a taster on what portfolio construction entails, and how to go about extracting as much value as you can out of your very own simple momentum / mean-reversion equity portfolio.

So, until next time,

Happy Trading.

The post Dangers of Backtesting, Over-Leverage and the Need for a Protective Stop appeared first on FXMasterCourse.

]]>The post Taking Control of Your Trading Numbers appeared first on FXMasterCourse.

]]>Well, many people got back after last week’s article asking about the details of the calculations as well as about some of the more technical jargon:

- What do I mean by asset?
- What’s an asset bias?
- What does it mean to risk-adjust returns?
- How can I go about calculating the charts in the article?
- How do I actually trade this?

This is the danger with being so specialized in a topic: I tend to take the basics for granted. And hence the need for this detailed side-track.

So before jumping in to the second article in this series, Building Profitable Trading Systems Using Mean-Reversion, I felt that it would be better to cover the basics. To get you to the point where you feel you are in control of the trading numbers that are being presented online.

At the end of this article you’ll find both an Excel spreadsheet and a Python script to replicate the calculations. You’ll have a foundation for taking control of your trading numbers

**JARGON BUSTING**

Let’s start by busting some of the complex words:

**Asset**: anything you can buy and sell and has some form of intrinsic value. An equity, a bond, maybe even a wine bottle**Asset bias**: the price of the asset has a clearly defined price pattern. Meaning that you have an edge on forecasting what will happen next.**Edge**: there’s a greater than 50-50 chance of your forecasted outcome occurring. Meaning that in the long-run your forecasts tend to work out, and hence add to your bottom line.**ETF**: stands for Exchange Trade Fund. In the previous article we focused on the SPY ETF because it allowed us to trade the S&P 500. An ETF is a fund managed by a fund manager, who specifies the strategy they will follow (e.g. track the S&P 500). The fund then issues shares which can be easily traded on the stock exchange. Over the last 20 years there has been a proliferation of such instruments tracking almost everything under the sun.

With this jargon busted let’s take a look at what we actually did in the previous article:

**SIX STEPS TO TAKING CONTROL OF YOUR TRADING NUMBERS**

**Step 1**: **We chose equities as our primary asset to investigate.** Why? Because we saw that they have an upside bias.A shout out to Murray who came back with a very good question: How can I tell if this is statistically significant? In other words, how do I know that I can trust this feature.

Well, for starters it’s the long-term nature of this feature that has gotten me convinced. The chart spanned 150 years! Not convinced, here is something going back 600 years:

You see, from a statistical point of view, it’s not just important to have many datapoints, but to have them span a significant amount of time. Any econometrician worth his salt will rather want 100 data points over the last 100 years, rather than one million data points over the last 2 months.

Why? Because establishing that the same patterns have been around for a much longer time, gives you the confidence to say that they will persist.

And remember, the whole point of trading is to make forecasts about the future with a certain degree of confidence. For that you need an Edge. And an Edge means having a better than 50-50 chance of my forecasted outcomes occurring!

**Step 2**:** We chose the S&P500 as a benchmark index for the equity market.** There is a bit of a sleight of hand involved here. When we say equities, many people think of single stocks. The big problem here is that there are literally thousands of stocks available for us to trade.

And many of these stocks come and go. Look at Eastman Kodak. The biggest camera company in the world had to file for bankruptcy, and re-structure its business after more than 100 years. Enron, Worldcom, Northern Rock, Merrill Lynch, Lehman Brothers also fall into the category of dodo-stocks.

Do you really want to have the headaches of wondering which of your investments will be around tomorrow?

One thing we know for sure: the market will be (if it isn’t neither will you). And that’s the purpose of the S&P500: __to track the market__. It is an average of the 500 biggest companies in the US. If one goes bust, another takes its place, but the index is still there.

And the people responsible for managing the SPY ETF (which tracks the index) are responsible for kicking the individual shares of companies which are about to go bust out of their holdings.

By trading the market we cut all the fluff around having to worry about individual equities, and we can make ** macro** statements about the economy instead. Something that (at least in my opinion) is easier and less time consuming.

**Step 3**: **We chose an index which included its dividends re-invested.** This is an important concept!

You see, when you own a share, that company most likely will pay out dividends back to you, as the shareholder. These dividends are part of the profits the company makes, and as a part-owner of the company you are entitled to these profits.

Now you have a choice: either blow the dividends on some fancy gadget, new home, or luxury holiday, or take that money and use it to buy more shares.

Choosing the latter option of buying more shares will give you a bigger exposure to the market, and make you more money ultimately.

That’s why we focus on the Total Return index, which measures performance with dividends re-invested! (This is the Adjusted Close in the Yahoo Finance data you can download)

**Step 4**: **We analysed a set of rule-based strategies**, so that we could compare them to the market benchmark, the S&P 500 with dividends re-invested.

The whole point was to present a set of black-and-white rules which you could follow without thinking. Remember: trade something that is tested and validated on rules which are replicable and repeatable! Otherwise you won’t have a clue what you should do in the future.

And most importantly the strategies we chose only required you trade ** once**. I’m not sure I made this point amply clear in the previous article!

You see, a lot of trading guides will advocate screen staring, and intraday trading.

There is a really simple rule of thumb here: The amount of pain you experience grows like the square of the number of times you observe the market. This relationship has to do with the volatility of the market. Details aside, it means that observing the market twice as much, means experiencing pain four times high. You get the picture.

Therefore trading once a month puts you squarely in psychological nirvana!

**Step 5**: **To make comparisons fair amongst the various investment options we risk-adjusted the returns.** This is probably the opaquest of all technical terms used in the article, so let me dive into a bit more depth here.

Risk is defined by how much our P&L fluctuates. To be precise, if we buy an asset or follow a strategy we will be booking a P&L for every day we hold that asset. This P&L will be just the change in value from the previous day and represents our profit or loss.

We can measure this P&L in dollar terms, but this isn’t very helpful, since it doesn’t tell us how much we started out with in the first place. That’s why people use percentages. It tells you the fraction of money, given your initial investment, you would have booked on that particular day.

Equipped with this percentage P&L we can chart out a distribution of the daily returns.

Let’s do this now for the S&P 500 buy and hold strategy, where we look at monthly returns. To be clear, I define monthly returns here as the percentage returns from month-end to month-end. For instance: take the closing price in September, divide by the closing price in August and subtract 1 to get the percentage change of the S&P 500 over the month of September.

If this return is +1.0% it means that if we had started with $100 we would have ended up with $101 after the month of September. You see, working in percentages is actually a very useful approach.

By using the index which includes dividend returns we also include the effect of dividends upon our returns.

The resulting distribution of S&P 500 monthly returns is:

So how do we use this distribution to determine the ** risk** of the S&P 500? Going back to the idea of risk as being encapsulated by our P&L fluctuations, we would like to know how much these fluctuations are on average. In a sense, we are looking for the average thickness in the above distribution. The technical terms is Standard Deviation (the STDEV function in EXCEL!).

For this distribution the average P&L swing is 4%. That is, 4% per month.

Now for a really important point: if I know that my P&L swings 4% a month, how much does it swing on a single day, or how much should I expect it to swing over an entire year.

Here it gets a bit tricky, because risk (or volatility as it is known) doesn’t scale linearly with time. It scales via the square-root of time. A formula is worth a thousand words:

- A year is 12 times longer than a month. So rather than taking my monthly risk of 4% and scaling it up by 12, I scale it up by the square root of 12 which is roughly equal to 3.5. So, my monthly P&L swing is roughly 14%. So I should expect the S&P 500 on average to be up or down by roughly 14% every year.
- A day is a twentieth of a month (there are 20 business days in a month). But again, it doesn’t mean that my risk for the day is a twentieth of 4%. Actually, I need to divide 4% by the square root of 20 = 4%/4.5 = 0.9% swing per day.

You see from this that volatility is not the most intuitive of concepts. At its heart it codifies the notion of randomness. And randomness bears some very unintuitive facts.

So, back to the original question: ** risk adjust returns**?

Simple: we multiply the returns of one strategy so that its standard deviation is equal to the standard deviation of our base strategy. In this way both strategies have the same risk, according to the definition of risk we have provided above: equal average P&L swings!

**Step 6**: **We implemented the Momentum strategy. ** Why Momentum as a bias?

Well, just like Equities have shown a persistent tendency to go up, momentum strategies have performed similarly.

Here is an interesting result that shows momentum applied to various assets (starting with 10 in 1300 all the way up to 90 in 2000) over the last 700 years:

That’s a pretty impressive result!

So how did we apply this to the SPY?

In line with the philosophy of trading stress free, you observe the value of the SPY at the end of every month. If this value is bigger than the value 12 months ago, you hold the SPY. If not, you sell your holding (and put your money in a cash account earning interest).

At the end of the next month you perform the same observation. If the market has recovered and is again higher than it was 12 months ago you enter the market again.

Note: you only trade at the end of the month, and always with reference to its level 12 months ago.

Since we are focused on the Total Return performance, meaning dividends reinvested, you need to take this into account by looking at the Total Return series.

**APPLYING THEORY: TAKING CONTROL OF YOUR TRADING NUMBERS**

Now, this was a lot of theory to take in.

So, let’s go ahead now and actually replicate some of the charts from the previous article.

**Data Sources**

For starters our data source will be: SPY

Here’s a screenshot:

Note the areas with red rectangles. These are the fields you have to modify. And the Adj Close will be the data series we will be using, after you download the data.

**Excel Backtest**

Once you have downloaded the csv file, you can start applying the rules we just discussed in Excel. The spreadsheet looks like:

You can download the spreadsheet here, and you’ll get the chart of the risk-adjusted Momentum strategy compared to the SPY buy-and-hold strategy:

## SPY 12 Month Momentum Filtered Backtest in Excel 82.79 KB 14 downloads

Taking control of your trading numbers is very important. Here is an example of...

**Python Backtest**

For all you Python fanatics, here is the script in Python. You can obviously change it to apply to any ticker you want.

import matplotlib.pyplot as plt import numpy as np from pandas_datareader import data as pdr import fix_yahoo_finance as yf yf.pdr_override() if __name__=="__main__": data = pdr.get_data_yahoo('SPY', start='1990-01-01', end='2017-10-02', interval="1mo") c = data[["Adj Close"]] c["spy"] = c["Adj Close"] / c.ix[0,"Adj Close"] c["rets"]=c["spy"]/c["spy"].shift(1)-1 c["flag"]=np.where(c["Adj Close"]>c["Adj Close"].shift(12),1,0) c["mom_ret"] = c["flag"].shift(1) * c["rets"] std_spy = c["rets"].std() std_mom = c["mom_ret"].std() fac = std_spy / std_mom c["mom"] = (1+c["mom_ret"]).cumprod() c["mom_lev"] = (1 + c["mom_ret"] * fac).cumprod() plt.plot(c.index, c["spy"], label="spy") plt.hold(True) plt.plot(c.index, c["mom"], label="spy 12m - mom") plt.plot(c.index, c["mom_lev"], label="spy 12m lev") plt.grid() plt.title("SPY vs SPY 12 Month Momentum vs SPY Momentum Leveraged", fontdict={'fontsize':24, 'fontweight':'bold'}) plt.legend(prop={'size':16}) plt.show()

You’ll also have to make sure that the necessary packages are installed (as specified in the import section), however, a package manager like conda from Anaconda will make this easy for you. Also note, that you need to be using Python 3.x to make this run.

The end result looks like identical to the Excel output (however, you can now easily test this strategy by changing look back lengths, the ticker and more!):

**RECAP**

The purpose of this article was to get you up to speed on the details of the previous article.

We’ve covered:

- Jargon Busting, in particular what I mean by selecting Equity as and Asset which exhibits an upward bias as well as a momentum bias, and how you can trade it by using ETFs.
- I showed you why trading the market is easier than trading single stocks.
- I also hammered the point home: trade infrequently, sit on your hands. Vol scales as square root of time, and hence the more frequent you observe, the higher your experienced pain will be
- What it means to take dividends into account
- How we risk adjust returns (remember: just multiply your returns to make the risk the same!)
- And finally, how to actually trade the momentum strategy and what the underlying calculations look like.

This forms a solid foundation for the continuing articles in the series, in particular when it comes to understanding how to allocate money amongst the various components.

One thing we still haven’t covered: how does a simple multiplication of a return translate into actual position sizing at my brokerage? For that matter, what is a brokerage, and how do those guys deal with my multiplicative factor?? Don’t worry, that’s what the rest of the article series will cover!

__See You Next Time…__

Next time round, we’ll be continuing with a technical variant of mean-reversion for equities which has proven profitable over the last 25 years, and which doesn’t let up. (Promise! No detour foreseen)

I’ll also give you a taster on what portfolio construction entails, and how to go about extracting as much value as you can out of your very own simple momentum / mean-reversion equity portfolio.

So, until next time,

Happy Trading.

The post Taking Control of Your Trading Numbers appeared first on FXMasterCourse.

]]>The post Building Consistently Profitable Trading Systems – Principles of a Successful Trading Approach, Part 1 appeared first on FXMasterCourse.

]]>This article series does exactly that. Here are the steps which we’ll work through:

- Define the underlying principles of a successful trading approach
- Determine the assets which obey these principles
- Determine rule sets for trading these assets
- Work out a straightforward portfolio construction method

That’s the theory.

In this article-series we’ll go a step further and look at how to implement and automate this process, in terms of instruments / brokers, as well as writing some Python funky scripts.

__ __

** Principles of a Successful Trading Approach**.

So, let’s hop in to the first part of this series: *Principles of a Successful Trading Approach*.

The point about principles is they act as a guide, keeping you on the right path. Most people pursue trading as a hobby, chasing shiny objects (viz. systems / indicators / expert-advisors), always lured by promises of big returns, never asking how these returns can be achieved.

However, some straightforward research goes a long way to show that keeping to the basics can reap big profits (google Buffett, Dalio’s All-Weather fund, even the good old buy-and-hold equity strategy makes money) in building consistently profitable trading systems.

So, what are these guide-posts? Here are the golden three:

**Principle #1**: Assets have biases. We simply have to figure out which assets have what bias.

**Principle #2**: We need to have a rule based approach to extract value. Why rule based? Why not just wave our hands and interpret the market using our gut instinct, or hyper-developed textual analysis machine, the brain? Because you can’t TEST that! What’s the point in trading an untested approach? That’s especially true for pattern based technical analysis (viz. heads-and-shoulders and co.) You wanna gamble, go to Vegas.

**Principle #3**: It’s no good finding ways to extract value out of all these assets if you don’t optimize the returns. Optimization here falls into two categories: combining them into a portfolio, to smooth out performance. As well as, finding the right leverage to boost your returns. It’s important to recall Druckenmiller’s words: “It takes courage to be a pig. It takes a courage to ride a profit with huge leverage.”

Having covered these fundamental guiding principles, we need to get a handle on how to exactly turn them into actionable trading systems.

We’ll start out with Principle #1**.**

__Asset Biases__

When it comes to assets, you gotta keep to things that you can invest in easily. In order of increasing difficulty (both in terms of understanding what’s going on and access) these are:

- Equities
- Bonds
- Commodities
- Currencies
- Everything else. And by that, I mean “alternatives” such as credit, hedge funds, real estate, volatility.

Though you can buy most of the alternatives in (5) via ETFs now-a-days, we’ll keep them out of the tool box for the time being, due to a lack of a long enough history.

**Equities. **What do you know about equities?

Well, they tend to go up. Don’t believe me, or are you getting pulled into the “wait for the dip” hysteria; here is a chart going back to 1871 (with and without dividends re-invested):

By the way the vertical scale is a log10 scale. Meaning these curves grow exponentially!

Even better. Take some time off and watch this video: RenTec Guy (Robert Frey) Gives Amazing Equity Speach

So that’s a bias: the “equities go up”-bias.

Any other biases we can think of?

Well for starters the biases that have been persistent across asset classes have been:

- Momentum
- Value
- Carry

Let’s define these.

__Momentum__

Things tend to go in the direction of their previous move. So if it went up, it’ll continue to go up. If it goes down, it’ll continue to go down.

How does that work for equities?

Well, one of the simplest momentum strategies has been: if it’s gone up for the last 12 months keep holding, otherwise go flat (or even short, if you have the guts for it).

Let’s see what that would have done for us on the S&P500 data above:

At first blush, the momentum filter doesn’t add much. But first looks are deceptive. Let’s compare these numbers in more detail. Note: all comparisons will be done on the dividend adjusted indices.

So, if you compare the riskiness of the S&P 500 index with the riskiness of the S&P 500 index filtered by 12-month momentum, you’ll see that the unfiltered returns are one and a half times as risky. Specifically, let’s work out the standard deviation of the two return-series:

S&P 500 with dividends = 14.0%

S&P 500 with dividends and momentum filter applied = 10.0%

So, if we’re going to compare apples with apples, we have to adjust the riskiness on of these two.

Given that people seem to always base-line their risk on standard equity investments, let’s risk up the filtered index (in real life we would do that by applying leverage, more on that later in this series).

The outcome is:

Now, admittedly, we are dealing here with re-constructed numbers and synthetic indices.

So, let’s move on to a real tradable. In the case of the S&P500 the easiest way to trade it is via the SPY ETF. This instrument is a tradable share on the NYSE. It’s been around since 1993 and you can grab the data at https://finance.yahoo.com/quote/spy/history?p=spy

Applying the same strategy (and risk-adjusting the momentum filtered returns to correspond the SPY risk) we get:

Not too bad!

So, we’ve improved on the buy-hold strategy using momentum. So, let’s go ahead and look at the other two.

__Value__

To perform a proper back test will be difficult. Primarily because it requires an extensive database of equities going back donkey’s years, together with all their financials, so that we can determine value.

In the spirit of keeping it simple, however, let’s just grab an ‘index’ that has been out there, reliably generating returns. Buffett’s Berkshire Hathaway. You can find the data here: https://finance.yahoo.com/quote/BRK-A/.

Note this is link is for the A series which currently stands at $200k. We’re using it as a data source as it has a long enough history. However, the B series, which stands now at $181 would be the much more affordable option, and shows the same performance. It’s history on the other hand is much shorter!

So, it certainly looks like value is the winner. However, let’s risk adjust all returns to equal to that of the SPY. The picture actually turns out to be slightly different:

If you’re still intent on implementing your own value strategy, it might be a good idea to check out these resources on how to construct your very own value portfolio: What Works on Wall Street, and The Little Book that Beats the Market.

Both books work on Benjamin Graham’s insight in later life that value can be easily derived from some very straightforward financial ratios (such as P/E, etc.). You then buy the ones with the most “value.” In the follow-up articles, we’ll see an even easier way of pursuing “value,” in a much more technical fashion.

__Carry__

Carry means earning an income. It’s something that is straightforward with Bonds to understand, since they’re built for income generation. But what about equities? Well, if you’re being old-fashioned, equities are supposed to generate income as well. That’s the point of being an owner in the business your holding the shares in. How? Via the dividends they pay.

Just to run some numbers past you: the S&P500 as a price index went up only 14,900% since 1871. Not too shabby you might say. Well taking into accounts the dividend income (and re-investing it), the actual return was: 135,200%. Nearly ten times as much.

The point about the Carry bias is to select those stocks which are paying especially high dividends.

A version of this strategy out there is the Dogs of the Dow strategy, though it has a bit of value mixed in as well (high-dividend yield means low price, and hence can imply an under-priced stock). In essence, the DoD says to simply buy and hold those stocks with the highest paying dividends. There’s even an ETF out there that since 2007 emulates this strategy. Its performance compared to the SPY is:

Spoiler alert: given how easy buy-and-hold and momentum strategies are compared to the other two strategies, we’ll take the easy way and simply include these two in our portfolio construction later in the article series.

__Recap__

This has been a long tour for the first part of this articles series: __Putting Together a Trading System from Scratch__. It’s good to take a break here and recap.

We’ve covered:

- The three principles you need to follow to be successful:
- Assets have biases, so find them
- Figure out rules to extract value
- Construct a portfolio that extracts value in an optimal way.

- Asset biases: we started out with equites and discovered that two of the simplest, and on a risk-adjusted measure most profitable approaches over the last 150 years was / is and most likely will continue to be momentum and buy-and-hold.

As you can see we still have some ground to cover (bonds, commodities, currencies and the lot).

__ __

__See You Next Time…__

Next time round, we’ll be continuing with a technical variant of mean-reversion for equities which has proven profitable over the last 25 years, and which doesn’t let up.

I’ll also give you a taster on what portfolio construction entails, and how to go about extracting as much value as you can out of your very own simple momentum / mean-reversion equity portfolio.

So, until next time,

Happy Trading.

The post Building Consistently Profitable Trading Systems – Principles of a Successful Trading Approach, Part 1 appeared first on FXMasterCourse.

]]>The post 4 Economic Indicators to help your Fundamental Trading of GBP– Part II appeared first on FXMasterCourse.

]]>The questions we’ll answer are:

- What economic indicators for GBP are out there and which can we use?
- How do you set up a macro system?
- What does it mean to trade a basket of currencies against GBP, or is there a preferred pair to trade?

Let’s cover the main themes that affect the Foreign Exchange Rate:

influences Central Bank behaviour, but also tells us about price increases, and therefore increases relative to other countries, and hence price competitiveness between the UK and its trading partners__Inflation:__: in times of excess can put pressure on currencies__External trade balances__GDP is made up of two main components: household consumption and private investment.__Domestic Output (GDP):__

Now that we’ve covered some factors that we think will influence the movement of currencies we need to determine which economic indicators / releases are actually required. Let me list them out:

covers inflation__CPI__:covers the external trade balances__Current Account:__covers the private household consumption component of GDP__Retail Sales:__in the case of the UK, with a large services sector this covers the other part of the GDP equation (as we saw in Part I)__Services PMI:__

Now these indicators don’t all come out at the same time. They come out at various times during the month, and also at various frequencies (for instance the Current Account numbers are quarterly whereas the other numbers are monthly).

So before we continue let’s formulate a way of constructing a way of trading these indicators. A very easy way is to create a binary-series of these indicators. It’s easier than it sounds! Start at zero, and if the indicator comes in above the previous reading add one, otherwise subtract one. Since we need to match up readings on the days in between readings, our indicator stays unchanged.

Let’s see how this works for Services PMI. The data we use is from ForexFactory and you can download the python script to extract it from here. The original series on a daily frequency is:

Of course it’s a step-wise graph, since we have releases only at the start of the month. So how does this look as a binary series once we just look at the direction of changes rather than size? Here it is:

As you can see the structure is maintained, however we have thrown out the size of the moves. The main reason for this approach: we will be combining a variety of indicators, each with different units, as well as different reporting timings and frequencies.

So what happens if we take all our indices and combine together over the period Jan 2007 until present?

We obtain:

As you can see they do track each other.

So what is the trading recipe?

It is actually quite straightforward: If our Economic Index increased since the last observation we buy GBP against a basket of currencies, if the index has decreased we sell it.

So what does the performance look like over the last nine years?

The results of this simple approach are quite impressive. For starters, reflecting a previous question on how to trade GBP versus a basket, this chart shows that you can get a bigger bang for your buck by picking the right counter currency to trade GBP against. In this particular example it turns out that focusing on the EUR outperforms not only the basket, but all other pairs as well.

For the GBP basket the Sharpe Ratio is 0.57. Good. But for GBP/EUR alone it is 0.90. Even better!

This is quite a remarkable result in the light of other benchmark indices trading at a Sharpe Ratio of only 0.5, such as the S&P500.

To recap: trading an economic index is not that difficult. You keep a scorecard of those economic releases that matter (according to the national accounting identity: GDP = Private Consumption + Private Investment + Government Spending + Net Exports), and you trade in the direction the index tells you to. And which counter currency do you use? Well the one that represents the largest trade partner. In the case of the UK (and hence the GBP) it is the Euro Zone, therefore you should trade GBP versus the EUR.

Of course you can apply this approach to any other country / currency-pair. And I urge you to go ahead and try it out! You now have a very objective approach to trading “macro”-news, other than the usual hand-wavy interpreting, which rarely leads to repeatable results you can test.

Happy trading.

The post 4 Economic Indicators to help your Fundamental Trading of GBP– Part II appeared first on FXMasterCourse.

]]>The post GBP, Brexit, and Fundamentals appeared first on FXMasterCourse.

]]>There have been many arguments for a bottoming out at the current levels, as well as for a continuation given the strength of the downward move experienced post Brexit.

In this article I’ll try to get a handle on possible outcomes, by looking at some fundamental indicators and see where they point to for sterling over the next couple of months.

The longer term perspective will be more difficult to gauge, since we are still in a state of flux, as long as the political situation hasn’t been clarified. By that I mean the particular details around trade, and how future goods flows will be negotiated between the UK and its future trade partners.

In this article we will start out by analysing domestic output and follow up next week with other economic factors.

But first let’s take a look at Sterling vs the US Dollar over the last 60 years:

There are some interesting conclusions to be drawn here. At first sight we can definitely identify a long term range, which has included equal or more violent moves than the current Brexit vote. As you can clearly see GBP indeed has broken through and attained multi-decade lows post the Brexit announcement. The headlines were full of this.

However, what happens if we look at GPB versus a basket of currencies; n particular against the G9 currencies (USD, EUR, JPY, CHF, CAD, AUD, NZD, SEK, NOK).

This tells a slightly different story. The “multi-decade” range had been pierced shortly after the GFC, especially after the strong carry-unwind trade driven by the high interest rates in the UK. It’s also interesting to note that all the gains throughout 2013/14 were completely wiped out once the referendum came on the table.

In some sense this tells us that the underlying economic conditions in the UK, are much more endemic, and not necessarily all of a sudden a result of Brexit. They are the result of structural conditions that have been built up for years, in which Brexit acted only as a catalyst. The current account deficit is an oft quoted indicator for that, and we’ll address that next week.

If you are technically inclined it’s very interesting to note that the previous level of 4.5 became strong resistance after 2008, and was also the level at which the pound recovery stalled.

The question of course is now how to get a fundamental handle on these movements.

We’ll approach it from the domestic output angle. On the domestic front, the PMI numbers tend to be popular, as they are a forward looking survey of the businesses within the country. Certainly many equity investors scour them to identify strengths and weaknesses within various sectors.

As such, they are reflective of positive domestic growth shocks if the PMI picks up, and negative shocks if the PMI declines. Domestic growth shocks, which ultimately are reflected in GDP growth (or decline), tend to bring along with them demand for domestic currency and hence an appreciation (or depreciation) of it.

So in this instance we’ll compare the PMI numbers month-on-month and use these monthly changes as an indicator for purchasing or selling the pound. If the PMI increases we buy the pound on the close of the day of the announcement, if it decreases we sell the pound. Note, that the specific PMI figure I chose was the Services PMI, as the services sector for the UK is far more relevant than the Construction or Manufacturing sector.

The strategy is very simple. Of course one hang-up is always the data. I’ve made available on my site a nifty little Python script, which will enable you to download a whole host of economic releases (with time stamps) going back to 2007. The great thing is that this information is not only incredibly valuable, but also utterly free, courtesy of our friends at ForexFactory.

The next question is how to trade the GBP. In this particular example we’ll actually go for GBP against an equally weighted basket of currencies as in the chart above.

The rationale here is that we’ll get a smoother P&L profile, and capture a more diverse flow of money into sterling.

So without further ado, here are the results:

There is one very remarkable event here, and that is Brexit. You see, the PMI number for June was strong, and that no doubt against the backdrop of most people’s complacency that the Bremain camp would win. Buying GBP into such an event is madness, and this is a good example of why manual system intervention in times of extraordinary events is needed. Simply stay out!

Furthermore the July PMI had been surveyed prior to the election event as well. It was only the ad-hoc 22^{nd} July number, which dropped off a cliff, that indicated the concern that followed Brexit, and the pessimism that set in. Playing a bit of Harry-hindsight and removing that outlier leads to:

which gives a tidy Sharpe Ratio of 0.5 over the 9 year period. Nothing to be sniffed at, if you include it as part of an overall portfolio

So how do we see GBP over the short term? Given the current continued decline in PMI numbers, and the most recent drop, it’s most likely that the trend will continue to the downside. And most likely get a kicker from the Article 50 catalyst once it’s triggered. That is of course disregarding the conspiracy theory camp, which claims it will never be triggered!

I urge you to give this strategy a shot with the other currencies and their respective PMI figures. As I said above you can get the data by downloading it from ForexFactory using this script I’ve put in the Forex Tools section.

Next week we’ll follow up with some more fundamental economic indicators, and find surprising results in unexpected quarters, so stay tuned!

Happy trading.

If you have enjoyed this post follow me on Twitter and sign-up to my Newsletter for weekly updates on trading strategies and other market insights!

The post GBP, Brexit, and Fundamentals appeared first on FXMasterCourse.

]]>