How to follow Trends on Currency Pairs

Introduction

Following trends is devastatingly simple. But you will only profit if trends are there to be followed. Strong trends, which last long enough to enable you to profit.

While this may sound obvious, it is not. No one really knows what makes a trend (or why) in the financial markets. The classic theory is that information takes a while to absorb and thus price moves slowly as more people come to believe that some fact or piece of news makes an instrument under or over valued.

As to how to capture a trend, that is at one level simplicity itself. If the price today is higher than it was a week ago, or a month ago, there is an uptrend. Whether or for how long the uptrend will continue is rather less easy to ascertain.

A strong and lasting trend is easily entered and you are not so easily shaken out of it. A weak trend, or worse a market which constantly changes direction, will mean that whatever method you use, you are likely to get chopped in and out of the markets losing money on each trade. So again: if there is a strong and continued trend you will make money. If there isn’t, you will lose.

Endless trend following systems have been devised over many decades. There has been a combinatorial explosion. Trend following has had it heroes and its villains.

Heroes are the likes of Bill Dunn, JW Henry and the Turtles. Or in more modern times, Winton, AHL and AQR are well know names. Take your pick.

The rogues are the droves of useless con men selling trend following systems, courses and books who have never actually traded and who have zero experience of markets. Such people make extravagant claims for the strategy making millions in up or down markets, and rely on quoting the comments and track records of successful traders or hedge funds rather than speaking from their own experience.

The would be trend trader is well advised to learn to code. Then he can decide for himself whether trend following is for him. It’s like the “teach a man to fish” trope. If a trader learns to code, he will not be fooled by others and will have only himself to congratulate (or blame) for his endeavors.

Learn to code

As those with experience know, back testing is not a guaranteed route to success. But it is the best hope we have got. What worked yesterday may not work tomorrow but at least trend following has a long and successful track record. So if there are trends, strong and lasting trends, the method should profit.

The trap with back testing (and it is a frighteningly real trap) is fitting the system to the data. It is all too easy to take one particular price series and choose a few parameters to yield huge back tested profits. You may well find that if you use a different price series or a different period on the same data series that the staggering profits become staggering losses.

Leverage

Moderation and common sense is therefore called for together with diversification over instruments and the avoidance of excessive leverage.

Without the use of leverage, a system may well make a return not so very different from buy and hold. But it may be able to achieve that return with less risk in terms of peak to valley draw down and volatility. With the use of leverage you may indeed make staggering returns for a period and equally staggering losses when the tide turns against you.

The System

Without further ado, here is a trend following system I have been playing around with. It aims to follow the market: buying the base currency against the quote when the base currency trend is up and the reverse when the trend is down.

I made no provision for interest paid and received on balances since the aim was to see what may be achievable on price alone.

If set to use “leverage”, short positions are achieved within the limits prescribed.

The following back test uses the following parameters to trade the USD/ARS currency pair. An example of a strong and continuing trend in the extreme. Needless to say the hypothetical profits are huge.

What you need to do next is to take a currency pair where the trend is less accentuated and persistent and you will find the same parameters result in a less than ideal output. The tendency will be to fiddle endlessly with the parameters to achieve similarly spectacular results but the more mature option is to choose more moderate parameters which will suit a wide range of currency pairs and to trade a portfolio.

Once again, it is essential to back test. And it is essential to learn how to code.

Learning a coding language will be an uphill struggle but will reap lasting rewards. Even if you invest or trade on fundamentals rather than technical patterns, back testing is essential and can help you decide whether your view of the markets is reasonable or, by contrast misguided.

It is just as easy to back test fundamentals, given the data, as indicators based on price. And you are better to start from scratch using you own small programs than becoming overwhelmed using a massive commerical program where you will get lost in the details.

Start small and you will achieve freedom.

Parameters and Results

start: datetime.date = ‘2014-11-07’
end: datetime.date = ‘2019-10-07’

base: float = 1000
quote: float = 16
bet_size: float = 0.1
comm: float = 0.001

profit_taking: str = False
profit_pct:int = 0.1

base_reset: float = 1
days_to_trade: int = 10
max_leverage: float = 4

sma_length: int = 5
lma_length: int = 20

Here is an explanation of the user defined variables:

SMA / LMA The trend filter is a moving average crossover. Setting moving average lengths of 5 and 20 will allow for rapid and close following of the trend. Settings of 50 and 200 will mean less trading and a system that is slower to react to change.

Bet Size. “bet_size” – represents the trade size in terms of a percentage of the amount of total equity held at the time of the relevant trade.

Commission Simulate commissions and spreads as a deduction from your trading equity.

Quote / Base. “quote” and “base” represent the amounts of quote and base currency held at the start of the test.

Profit Taking. If set to true, the base and quote currencies will be re-balanced each time the account equity rises by profit_pct, when the counter is reset.

Base Reset How to reset the account when profit taking. If set to 1, the entire account will be re-set as base currency. If set to 0.5 half the account will be reset to base and half to quote.

Days to Trade if set to 1, the system will trade every day – providing the trend and other filters allow trading for that day. Set to 20 to trade monthly or 60 to trade quarterly.

Max Leverage If set to zero, no base currency or quote currency will be sold unless there is a positive balance of such currency in the account. If set to 1, base or quote currency can be shorted up to the total value of equity in the account.

Here are the results of the back test:

Stat equity benchmark
Start 2014-11-07 2014-11-07
End 2019-10-07 2019-10-07
Risk-free rate0.00%0.00%
  
Total Return746.69%-85.21%
Daily Sharpe1.17-1.45
Daily Sortino4.38-1.68
CAGR54.45%-32.22%
Max Drawdown-16.67%-85.88%
Calmar Ratio3.27-0.38

Sample csv output files and charts can be downloaded free here.

And here are the charts:

10 Comments

  1. >Lean to code
    Been there, done that. I even actually found one of the “holy grails” we are looking for.
    What now? I can’t sell the idea to customers, The hedge-fund guys and fund managers I know don’t even know what the scientific method is and are more interested in leveraging up their asinine trading ideas..

    Like

      1. Well I guess it depends what return you are aiming for. 8% cagr on 10,000 GBP isn’t going to go far. I guess the trick on “no capital” is to find some rare opportunity for outsized returns.

        Like

      2. Have you looked at Quantconnect at all? Rather refreshing after the crushing uniformity of approach now imposed by Quantopian. I am just fiddling around learning their IDE etc

        Like

      3. I test strategies in Quantopian notebooks, then I write and backtest Quantopian algos, then I convert it into QuantConnect code and trade it there.
        Right now I am writing emails and visiting boring conventions to tell uninterested people about my strategy. As of today they are all completely blind to the opportunity or just tell me that their customers are okay with 1% per year so why try something new. Maybe I haven’t found the right people yet.

        Like

Leave a comment