Thursday, October 25, 2018

Preliminary Results-The Fisher Transform-When to Buy and Sell

.
If you are on the blog page in a web browser from a computer, please subscribe to this using the "Follow by Email" link to the left.  If you're on a mobile device you should see something in the frame that allows you to subscribe.  Having your email helps me to notify you when Google mucks up email distribution.

~~~~~~~~~~

The Fisher Transform

Much of my focus as of late has been on John Ehlers' work, specifically the art of making the Fisher Transform actionable.  If you have not been following this thread you can review the Fisher Transform here:  https://www.mesasoftware.com/papers/UsingTheFisherTransform.pdf 

Summarizing, the most common moving average method compares two moving averages, a shorter one and a longer one, and when the shorter one crosses the longer one we have a turning point.  The problem with moving averages is that they introduce lag, and hence, the longer the time frame being measured, the more lag that is introduced into the signal.

The  Fisher Transform differs from moving average methods in that it does not use moving averages -- it looks at a window of prices and based upon this window it adjusts the current price as defined by the transform. Hence, it has virtually no lag, and is very quick to identify possible turning points.  In general, it works and is quicker than moving averages and relative strength indicators, so push the "I believe button", at least for now.

As you dig into the use of the indicator you will quickly realize that there are several conditions that can occur.  For example:

  • If the Fisher Transform is in an uptrend, should I enter?  It could have been in an uptrend on the last bar also.  Is the signal too old?
  • If the Fisher Transform is in a downtrend, should I exit?  Same thought process as the previous questions.
  • If the Fisher Transform signal is new and the previous bar is opposite the new signal, is this a good entry or exit point?
The analysis gets more complicated if multi-timeframes are introduced into the mix.  For example, if I have weekly and daily bars, and run the Fisher Transform on each of these time periods, does this reduce or improve entry/exit performance?  Specifically, all the questions above apply, but now:
  • Does the state of the weekly Fisher Transform signal provide any improvement to performance?
  • What is the correct window length for the weekly Fisher Transform?  Is it the same as the daily Fisher Transform?  Does this window length materially change realized performance?
You get the idea.  Things get complicated quite quickly.

Fisher Transform Testing Results

I'm not going to give every minutia of details here but will summarize enough that those skilled in the art of backtesting should be able to approximately duplicate my results.  Here is the setup:
  • Sample Duration:  10 years
  • Moving Window Approach:  2004-2014, 2006-2016, 2008-2018, all windows ending on 9/30 of their respective year
  • Sample Stocks:  The stocks of the S&P 500.  The 2004 set of runs only utilized 486 of the possible set.
  • Starting equity:  $100,000.00, no margin.
  • Position Size:  0.5% of equity, commissions & slippage not considered
  • Fisher Transform Window Size:  10 days for Daily, 5 weeks for Weekly.  I have discussed elsewhere that John Ehlers picked the 10-day window length and I've confirmed that this is the best length given multiple window tests.
  • Position entry requirement:  The close > 50d MA > 150d MA > 200d MA.  
  • Enter / exit on the close of the signal bar
  • If entering a position, hold it at least 1 bar to avoid whipsaws.
The testing methodology tests for a number of conditions:
  • vary the weekly entry signal for both a downtrend entry as well as an uptrend entry
  • vary the daily entry signal for both a downtrend entry as well as an uptrend entry
  • vary the entry (daily or weekly) such that only enter / exit on a change from the previous state, for example, only enter if the daily/weekly meet a known condition and yesterday's daily signal was different from today's (same thing with the weekly)
  • ignore the weekly and only consider daily entry/exit signals, all within the context of change from the previous day's signal
The following is a representative equity curve and drawdown profile for one of the tests, for the period 2008-2018:

Click on the image to enlarge

This is an "okay" equity curve, but there are flat periods that would have challenged whether you stick with the strategy and sit in cash or worse yet, with a paper loss in your account.

The individual equity curves look more / less like this across all of the sample periods.  Here is the same presentation but from 2004 - 2014:


Click on the image to enlarge

You can see that the period of the 2008-9 financial crisis is relatively flat, which is an outcome of the 50-150-200d MA requirement for entry (see note at top of this post).

I stress that none of the other parameters in the account are optimized (position size, emergency stop exits, etc.) so you should not infer too much into this strategy.  For example, the strategy most likely would benefit from some sort of emergency stop:

Click on the image to enlarge

This is the Maximum Adverse Excursion (MAE) plot, which plots drawdown on the X-axis and profit/loss on the Y-axis.  Wins are cyan, losses are magenta.  A large majority of positions have some drawdown before they recover.  Some never recover.  Clearly, there are more losses below ~ 27%, so having an emergency stop in this area most likely would benefit the strategy.  

Mark that for future analysis.

Drum roll please ...

The following outcomes do not represent the highest equity peak, the highest K-Ratio, nor the highest Sharpe Ratio.  I find that zeroing in on a single parameter is a fools errand, so I tend to look for groupings of performance where each of those parameters is "in the same ballpark", and have consistent outcomes across various moving window time frames.

Click on the image to enlarge

Here's what you are looking at, left to right:
  1. Test Number:  Nothing to infer here.
  2. Total Return: Nothing to infer here either, except that there is a variance of returns.  $100K doubles the money in 10 years; $170K nearly triples the money in money in 10 years.  Rule of 72's and all of that.
  3. Trades: Fewer trades with the top performer (37), which means you probably have to have a greater tolerance for drawdown. 
  4. Avg Trade/Drawdown/Max Drawdown:  Self evident
  5. Sharpe Ratio:  in general, the higher, the better, but SR has limitations
  6. K-Ratio:  in general, the higher the better.  The larger the number the more steady the returns
  7. Total Return / Max Drawdown:  Larger is better
  8. Inputs:  Wbuy, Dbuy, WSell, DSell:  test harness conditions.  The right 4 columns break these out so I can filter.
Your takeaways are these (and I was a bit surprised):
  1. Enter when the WEEKLY Fisher Transform transitions from an uptrend to a downtrend AND the DAILY is already in a downtrend.  Put another way, do not ENTER until the WEEKLY confirms the daily downtrend.
  2.  Enter when the DAILY Fisher Transform transitions from an uptrend to a downtrend AND the WEEKLY is already in a downtrend.  Put another way, if the weekly is already in a downtrend and the daily has hung on, as soon as the daily flips to a downtrend, ENTER. 
  3. Exit criteria varies.  The "1", "-1", and "0" mean that for selling, weekly status doesn't really matter - it's the change in weekly that counts.  The weekly signals help.
  4. Exit when the DAILY signal moves to a downtrend from an uptrend.  This was common for all entry cases.  Remember -- bar count is at least 1 bar (a day), so there is no same-day selling as the day you entered.  The entry and exit signals are not in conflict.
~~~~~~~~~

I've been doing daily analysis on the Fisher Transform and I'm impressed.  It's not a holy grail, but it is pretty darn good at identifying turning points and what you should be doing with positions.

The results to date have been somewhat counter-intuitive, specifically regarding entering the position when we are transitioning to a downtrend; when I started to look at the trades it made sense if we are to capture the full range of the trend and most of the stocks are already in an uptrend.

Additionally, the selling criteria using the weekly exit signal dramatically improves returns.  Adding the selling criteria of ANY weekly transition (uptrend to downtrend or downtrend to uptrend) beat simply using the daily exit.  The table below shows a 2.6% average return for each daily exit, and a 3.2% return for each weekly exit, independent of direction of the weekly transition.

Signal Name Average of Profit(%)
DayTransExit 0.026120579
WkTransExit 0.032469279

Grand Total 0.028515908

~~~~~~~~~~

Additional work that follows is now to consider position size (what is the optimal position size?), and to look at putting emergency stops in place.  Note that I'm loathe to put a stop in any strategy, so I need to see that somehow a position is trapped and has no chance of recovery, based upon my rules, and that a back door is required.

~~~~~~~~~


That's all for now.  If you have questions -- ask.

~~~~~~~~~

As with all my ramblings, you are responsible for your own actions and I am not.  Nothing I've written here is advice to buy or sell any security, so don't do it unless you absolutely take ownership for your actions.

Regards,

Paul




No comments:

Post a Comment