Wednesday, 14 November 2012

GO! Standard

I have just set up a new expert advisor on the GO! Standard account. This account will be traded by a modified version of the  HumbleScalp system I described some time ago. Basically the improvements are:
  • added a few additional complementary strategies to bring down drawdown. Their trading style is the same, entry conditions are just different for each strategy. This smooths the equity curve a lot, and I am a big supporter of this approach. Usually a few instances of the same strategy ran with different parameters will have much slightly lower profit but much lower drawdown than single instance with higher risk. 
  • improved calculation of SL and TP - calculated based on recent volatility and not recent range. Some limitation to the maximum and minimum SL and TP still applies to avoid too low or too high levels. 
  • slightly changed position management (it can take up 18 trades to follow one move). This change goes in pair with adding new strategies, simply each strategy can use just a few slots out of the available pool.
Below is a year by year 10 years EURUSD backtest (Alpari UK data, 0.8 pip spread). I know when you see backtest like this, you think this is some shitty EA that abuses the MetaTrader backtest module and opens and closes trades within one, 1-minute bar (which will produce false results, as Metatrder is considering only OHLC data from lowest available timeframe 1-mintue in the backtest). But actually the average trade time is around 1 hour. By the way I also resigned from fancy take profit trailing, because I believe Metatrader backtester is also unreliable when trailing is done with less pips then bar size.

I have a few ideas for improvement up my sleves, but I'll see how the strategy will perform on this level. I will run it with a rather high risk (nothing new though...). 

2002:
 2003:
 2004:
 2005:
 2006:
 2007:
 2008:
 2009:
2010:
 2011:
 2012:


Tuesday, 13 November 2012

Time series similarity

One of the things I have been working on in the last months are time series similarity algorithms. Why? In principle, most trading systems use past data to enter a trade. So for instance you use 5 technical indicators to enter the market. Or maybe you are using classical technical analysis: double top/bottom or head and shoulders as entry signals... Basically, you are trying to find chart patterns that occurred in the past and produced more profit then loss.

My idea is: let's take last X prices. And look in all the history for a given instrument what were the most similar X prices  in the past and what happened in the next Y prices. For example:
  • Let's look at last 500 open prices on 1 minute chart
  • Find the most similar 500 open prices in the historical data
  • Check whether the price risen or fallen in the next 200 bars
Of course the challenge is: how to find the most similar piece of data from the past. My initial idea was rather trivial: take two data series and calculate an euclidean distance in each data point. If all the distances would be the same it would mean that the series are identical. However this approach wouldn't be very robust in presence of noise or for time shifted data... 

So I implemented an algorithm called Dynamic Time Warping. It is a rather simple approach to determining time series similarity, but it gives good results for vast variety of different classes of time series data. I will not write about the algorithm itself, as it is well described in Internet. I tried two things (not going into calculation details):
  1. Finding one most similar pattern from the past. 
  2. Finding many similar patterns and seeing whether there was a consistent behavior in directly subsequent data.
When I created a simple trading system leveraging above as an entry signal results were confusing in both cases. Some combinations of input parameters  were profitable, but small modification of the parameters resulted in no profit at all...  I done all the tests on EURUSD 2006-2011 1-minute and 5-minute data which is very consistent in its characteristics. Of course I was normalizing each data point by subtracting mean  and dividing by the standard deviation of a given probe.

As for now I am parking this idea, even though I believe there is a lot of value in it... But to further explore it I would need to spent much more time to implement other similarity algorithms:
  • more precise on varied datasets,
  • much faster in calculation. 
If you want to spend some time on this, I would suggest continue reading here: http://www.eecs.umich.edu/db/files/sigmod07timeseries.pdf