Code Snippet: FTSE Fridays

This code snippet below is a quick and dirty follow up to some statistical analysis performed on the FTSE 100. It showed that over the long run, (since 1995) going long on a Friday appeared to have a statistical edge (53%). As a bit of fun, I wanted to create a quick pine script backtest to test this and see if it is possible to profit from it. After all, the index might finish up 53% of the time, but that doesn’t mean one can profit from it. For a start, some of those winners may have only closed a fraction higher leaving the losers to eat our pie. Furthermore, overnight futures action might mean the index is well up before the open. If that was the case, it would be hard to profit from the strategy unless you are a spread bettor or futures trader. Finally, execution style might also prevent one from profiting. E.g. stops that are too tight.

A link to the original article is here: Statistical Analysis: FTSE 100 Period Trends

Code Assumptions

The code in this post is based on the following assumptions:

  1. The strategy will be traded at the open. This should allow the strategy to be traded with ETF’s.
  2. We have access to FTSE futures, CFD or spread betting data. In other words, we have access to Index data pre-market and post-market. Note: For the purposes of this post, Oanda’s UK100 CFD data was used.
  3. The script must run on the 4H time frame…..Why? It is a quick and dirty implementation and it relies on entering a long position on the 4H bar before the market opens. This way the position will enter at the open of the market. (Since positions are always opening on the bar following an entry signal).

The Code

A copy of the code can be found on Tradingview here: https://www.tradingview.com/script/EMbHfcnn-FTSE-Fridays/

Code Commentary

The two parameters in the code which might benefit from further explanation are:

  1. 4H low Stop Loss: This takes the low of the 4H prior to the market. I was interested to see if the pre-market lows would often be hit during open hours for winning days. If not, the stop should limit losses on days which go against us.
  2. Daily ATR stop: This sets the stop at the close – daily ATR value. The idea here is to give more room for the trade to breathe but also limit losses to one average days worth of movement.

Results

Chart showing the FTSE Friday's strategy

Over the last 5 years (2012 to Dec 2017), the default settings produce a return of 15% with a Max drawdown of 7% and the largest losing trade coming in at just 2%. If you add a 4H stop loss, the return is reduced (to 13%) but so is the max drawdown and largest losing trade (4.4% max drawdown and 0.7% largest losing trade). If an ATR based stop is used with a lookback period of 7, the net profit increases to 16%. However, so do the max drawdown and largest loser.  (6.56% and 1.69%).

Note that these results are subject to change as December plays out.

So overall, not a fantastic result to only return about 3% a year. However, when you consider the amount of time in the market to achieve those returns and consider that you never need to hold onto overnight risk, it becomes a little better in my opinion.

The main takeaway for me, however, is a reminder that simplicity works. We often find ourselves in the pursuit of complexity. Working hard and spending countless hours developing a “smart” strategy. Hard work must payoff right? It has to…We have this message ingrained in us from a young age. While I am sure no one will argue that in general, the path to bettering ourselves involves hard work, it doesn’t always work that way in the financial markets. So take a step back to the basics once in a while in order to see the woods for the trees.