Sunday, 3 April 2011

Exploratory AFIRMA trend line tests completed

As per my previous post, the exploratory tests of the AFIRMA trend line are now complete and the results are amazing. The tests in question were:
  • a Monte Carlo permutation test to accept or reject the null hypothesis that the results of the AFIRMA "system" are no better than could be expected from a random re-ordering of the system's position vector
  • a Monte Carlo bootstrap test to accept or reject the null hypothesis that the returns of the AFIRMA "system" are randomly centred around a zero return
Both the above tests are those that are described in Aronson's Evidence Based Technical Analysis and the AFIRMA passed both tests on all historical data series it was tested on, with the exception of the Dollar Index contract, with a p-value of zero. I suspect that it failed on the Dollar Index because of errors in the data I have for this contract. The AFIRMA that was tested had a window length of 9, which means that it "peeks into the future" for 4 bars, and a Blackman windowing function was used. The rules were quite simple: if the current bar's AFIRMA value is greater than that for the previous bar, go long at the open of the next bar or remain long if already so; and the reverse logic for shorts. No money management or stops were employed - it is a pure, one contract, always in the market test. The tests were conducted on daily bars covering the period from March 2001 to last week. The number crunching was done in Octave.

The next test was a simple visual check of the tick return equity, a simple plot of the cumulative number of ticks that the "system" would have returned. For this no allowance was made for commissions and slippage and a typical plot is shown below. This happens to be the S&P E-mini contract.

The AFIRMA is the blue line and the other lines are a simple benchmark suite I knocked up for comparative purposes, the benchmarks being
  • the equivalent of a buy and hold strategy
  • price closing above/below the 20 period simple moving average
  • price closing above/below the 50 period simple moving average
  • crossovers of the 20 and 50 period moving averages
  • a Donchian breakout system with a parameter of 20 periods to enter and 10 to exit
This second chart was created in R using the PerformanceAnalytics package and shows the log return equity, the daily log returns and the draw downs of the above, the AFIRMA being the dark blue lines, labelled V2 in the legend.

This final shot is a screen capture of the R session, using RStudio, used to create the performance summary chart. This was the first time I had used RStudio, and I am quite impressed with it.

In summary I can say that the AFIRMA has passed the above tests sufficiently well that I am going to code the AFIRMA using the leading functions as described in my previous post.

No comments: