Wednesday, July 9, 2014

Trend trading 1500 tickers

Ticker Symbol
Ticker Symbol (Photo credit: LendingMemo)
In my previous post I showed a Python script that gets all the ticker symbols from Yahoo and Google that Plus500.com has references to. The reason for me to get lists of those tickers is that Plus500 provides a wide range of CFDs that follow these ticker symbols. The plus500 platform is pretty basic, to say the least, so I do not want to use it for analysis, but just for execution. Using their platform is however an easy way to trade of of signals that are generated by algorithms that take daily price data from about 1500 symbols provided by Yahoo an Google finance. My idea was to backtest some trend- / swingtrading strategies on all the different sets of price data from all the different symbols. Then rank them based on sharpe ratio and winratio and then only trade the highest ranking ones.

The basic idea is simple. I only want to trade in the direction of the trend and only when there is a "strong" trend. I want to exit trades when the trend is done or stalling. Recognizing trends can be done in many ways. To keep things simple so that I can always manually verify signals I choose to implement an algo with 3 Simple Moving Averages. I believe this is a pretty common way for traders to look at the market. All I wanted to add to this is to have a market screening app that gives my signals when trade opportunities present themselves. I will then look at the opportunities and decide to act upon them or not. So there will be no automated trading here.

The rules for the screening are:

  • if price is above the long term moving average, we will only look for long trades
  • then if the short term moving average crosses up over the midterm moving average, we will buy on the next day open.
  • and when the short term moving average crosses down over the midterm moving average, we will exit the long position on the next day open.

And in reverse:

  • if price is below the long term moving average, we will only trade short (which is easy to do with Plus500's CFDs)
  • then if the short term moving average crosses down over the midterm moving average, we will sell on the next day open.
  • and when the short term moving average crosses up again over the midterm moving average, we will exit the long position on the next day open.
I backtested this strategy with the most commonly used movingaverages, like the 200 and 150 day moving average for the long term, 20 and 50 for the mid term and a range from 3 day to 14 day for the short term moving average. It took a couple of hours to run through all the backtests, but then I ended up with a list of tickers with combination of moving averages and a ranking based on how well the performance was in the past 2 years.

Then I filtered this list to show only combinations that had a substantial amount of trades and a sharpe of above 2.
Here are my results for the Yahoo tickerlist.
M1, m2 and m3 are the short, mid and long term simple moving averages, that gave optimum results, but I noticed that all the commonly used combinations of MAs gave more or less the same results. The screening therefore merely filters out which tickers have been doing well with this algo for the past 2 years. The idea is that many of them will continue to perform with this algo the coming year; many but not all. We will need to create a new ranking every month or every quarter to adjust to the markets. And if we implement proper money management we might have an edge be profitable trading this way.


Where to go from here? Well, I will still need to backtest on the Google Finance tickers data sets and combine the results into one ranking list. Then I will have to create a signal service, that will get and analyse the data everyday and sends me an email with trading entry suggestions. I will then paper trade on plus500 and share the results.

If all goes well I intend to trade this way on a live account at plus500.com and on a "normal" brokerage account trading options.