21
Mechanized Frog Project – A Deep Analysis of The Frog Trading Strategy by Tony DeQuick May 2015 Background After Ken’s day trading workshop at Van Tharp WHQ in March 2015, Mark Clerkin, David Botero and I got together to create a mechanical version of the Frog for use in Tradestation. Some of the functions of the Frog require some advanced programming techniques, such as finding the high and low on an intraday chart. For this we employed Bill Brower to help us develop the mechanical Frog system. We then got to work testing every conceivable version of the Frog. Although the The Frog has defined rules, Ken traded it as a discretionary system. The system is fairly easy to adapt to a purely mechanical system with the key dilemma being the first trade in the Quick Frog and Slow Frog systems. With these systems, trades are not executed until 30 or 60 minutes into the trading day respectively. The dilemma with the 30 and 60 minute systems is what to do if a trade was triggered before the 30 or 60 minute time frame. Do we take the trade regardless? Matt’s QF30 system answers this question. Matt’s rule is if the trade hasn’t moved more than 1.0 frog box from the entry point, that we take the

Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

Mechanized Frog Project – A Deep Analysis of The Frog Trading Strategy

by Tony DeQuickMay 2015

Background

After Ken’s day trading workshop at Van Tharp WHQ in March 2015, Mark Clerkin, David Botero and I got together to create a mechanical version of the Frog for use in Tradestation. Some of the functions of the Frog require some advanced programming techniques, such as finding the high and low on an intraday chart. For this we employed Bill Brower to help us develop the mechanical Frog system. We then got to work testing every conceivable version of the Frog.

Although the The Frog has defined rules, Ken traded it as a discretionary system. The system is fairly easy to adapt to a purely mechanical system with the key dilemma being the first trade in the Quick Frog and Slow Frog systems. With these systems, trades are not executed until 30 or 60 minutes into the trading day respectively. The dilemma with the 30 and 60 minute systems is what to do if a trade was triggered before the 30 or 60 minute time frame. Do we take the trade regardless?

Matt’s QF30 system answers this question. Matt’s rule is if the trade hasn’t moved more than 1.0 frog box from the entry point, that we take the trade. From Matt’s presentation, he was using Think or Swim to perform his trading discretionarily. After lots of testing, it appears Matt’s rule of 1.0 is a good rule. Testing found .9 – 1.0 works very well across the board.

Testing Procedure

Our protocol for testing quickly became cumbersome. Extremely cumbersome. We tested the Dow 30 going back 10 years in 1 minute increments. Loading this amount of data in Tradestation is very tedious and slow. After some additional testing, I found negligible results in expectancy between using 2 minute bars in lieu of 1 minute bars, hence

Page 2: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

all testing was done in 2 minute bars, 10 years back. All testing is performed with 1R = 1 Frog box = $1000.

Position size is calculated based on $1000 / Frog Box . No slippage or commissions are included in the data as I found bugs in Tradestation testing with these items included.

The Limits of Tradestation

The amount of data we were testing also far exceeded the testing capabilities of Tradestation’s portfolio level testing tool, Portfolio Maestro. This tool allows the testing of an entire portfolio at once with a trading strategy, such as the Dow 30. Attempting to test with it caused Tradestation to crash or hang for hours. I moved my Tradestation setup to an Amazon EC2 instance running 8 Xeon processors with 100+ gigs of memory, and it still couldn’t handle it.

The way the Frog system works is to exit half the trade at 1R and trail the remaining 50% at 1/2R. Because of this, Tradestation counts each winning trade as two trades, skewing the expectancy.

For the purpose of testing, I found minimal difference in expectancy by unloading the entire position at 1R versus unloading 50% at 1R and trailing the remaining at 1/2R. For simplicity in calculating expectancy, all trades in these examples are exited at a 1R win, unless it’s an end of the day (EOD) exit. The end of the day exits at 25 minutes before the close of the trading session.

As workaround to both of these issues, David coded a custom .dll for Tradestation that exports each bar of a trade to a spreadsheet. The spreadsheet then manually calculates the expectancy and results for the entire portfolio. Each symbol in the portfolio has ~50,000 lines in the spreadsheet resulting in a colossal amount of data. It was a massive undertaking on all of our parts. Conservatively I estimate the amount of work into this research at 300 hours and growing.

Frog Champs and Frog Chumps

Page 3: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

From our testing, we found little to no correlation between the FQN number and expectancy. It also quickly became clear that some symbols were born Frog champs and some were chumps. After lots of analysis, I sorted symbols into three different groups:

1. Indigenous Frog Champs – These are symbols that perform well as-is. However even these symbols are marginally tradable by the time commissions and slippage are factored in. The only symbol that is tradable as-is is APPL. It is the all time reigning Frog Champ. The QF30 equity curve for APPL is below with an expectancy of .12 and win rate of 46.8%. The average winning trade is .88R and the average losing trade .55R. These symbols include APPL, EEW, RSX and EWZ. APPL is the champ of Champs. There are no SAR trades included as we found SAR trades have an expectancy 50% - 90% less than the first trade. In other words, they are not tradable. For the purpose of discussion, I will focus on EWZ and AAPL since EEW and RSX share similar DNA to EWZ.

Page 4: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

2. Potential Frogs – These symbols perform well in certain market types and volatility levels. Most of these symbols perform well in quiet markets. I defined volatility as the 100 day moving average of range +/- .25 standard deviations (SDs). These symbols include BA, GS, CAT, UNH, DIS, MMM, AAL, AMZN, TSLA, NFLX, CRM, PCLN, MSFT, DD, KO and CVX. Most of the leveraged ETFs also fit into this category. The below example of AMZN is typical of these symbols. The first screen shot is an equity curve of AMZN using QF30 with default settings.

The results are an expectancy of .04 before slippage and commissions. This isn’t tradable. The equity curve below is AMZN filtered for quiet markets. The expectancy of the system doubles to .08 however the number of trading opportunities is reduced by over 75% from ~1600 to just over ~300.

This is fairly typical of all symbols in this category.

Page 5: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

3. Frog Chumps – These symbols have an equity curve that is down and to the right (bad). These symbols include all of the Dow30 not in the other two categories, which is most of them. Some of the biggest chumps are the pharmaceuticals (PFE, JNJ, MRK) and big oil (XOM – super chump). Below is an equity curve for JNJ and it is typical of the Chumps.

There are enough Chumps that I started developing the Frog Chump system to trade the Chumps. Taking the equity curve below and flipping it around the $0 equity point (by taking the counter trade) and then finding the conditions in which QF30 performs the worst are the ideas behind this strategy.

What are the differences between a Frog Chump and a Frog Champ?

In testing, I found little (after factoring in degrees of freedom) or no correlation between the FQN and expectancy. For example, EWZ performs better with a FQN of 2.0 than with a FQN of 3.0.

This led to dissecting the Frog Champs and the AAA Frogs. The screenshot below is from a Radarscreen I coded for Frog development that provides insight into the inner workings of the Champs. The screen shows the average daily range percetange, over the last 90 days, sorted from low to high as well as other Frog parameters.

Page 6: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

It’s likely not a coincidence that our Frog Champs are near the top of the range list. However this is only a 90 day snapshot as of 5/23/2015. Looking at the 10 year daily charts of the Champs, what these Champs have in common is they have a consistently higher range as compared to the Chumps. Other symbols such as JPM and AXP had excessively high range during the bear markets and as such performed well then.

Applying a 2.0% range filter to APPL and EWZ reduced the number of trades by approximately 40%. However on XOM, applying the same 2.0% filter reduced the number of trades by almost 80%. The same pattern is typical of most of the chumps. Using a range filter of 2.0% cuts down the number of trades by around 80%. Using the range filter did not improve the expectancy of the Chumps or the Champs.

Page 7: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

Therefore, individual stocks or ETFs need consistently high range to perform well. Also of interest, both AAPL and EWZ consistently have the highest daily volume of the symbols tested.

Market Type and Volatility Filters

One of the tenants of Ken’s trading plan is to be aware of the big picture of the market and then to trade in harmony with these conditions. If we are in a bull market, we want to take long trades, etc. To apply these principals to the Champs, I created both market and volatility filters and then analyzed performance in each of these markets.

For market type, I defined a bull market as the daily close being + 1 standard deviation above the 200 moving average (MA), sideways within +/- 1 SD and bear below 1 SD. Volatility was defined as the 100 day moving average of the range, + .25 SDs being noisy, within +/- .25 SDs being normal and below .25 SD being quiet. Using .25 SDs for volatility divided most symbols up into 3 groups of approximately the same size. The market type filter and volatility filter were calculated using the individual symbol price, not SPY.

Appendix A is a screenshot of how AAPL and EWZ perform in the different market conditions. For the Tradestation code, +2 is all market types, +1 is bull, 0 is sideways, -1 is bear and -2 is bull and bear. For volatility, +2 is all volatility, +1 is noisy, 0 is normal, -1 is quiet and -2 is noisy and quiet.

From the chart, AAPL performs best when the it’s hugging the 200 day MA within 1 standard deviation, regardless of volatility. The expectancy is .17 (503 total trades) versus an expectancy of .12 (1558 total trades) for all market conditions. For conditions outside of +/- 1 SD, there are a total 1055 trades with an expectancy of .09.

EZW performs much different than AAPL. The overall expectancy for EZW is .08 (1886 total trades) for all market conditions and volatility levels. The largest grouping of best performing trades for EZW is in bull markets with all levels of volatility resulting in an expectancy of .12 (535 total trades). The next large grouping was in bull and bear markets

Page 8: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

with quiet volatility coming in with an expectancy of .22 (217 total trades).

The largest worst performing group for EZW is when it’s hugging the 200 day MA within 1 SD at any volatility level. In these market types it has an expectancy of .06 (873 total trades), which is ironically when AAPL has the highest expectancy.

Borrowing From The RLCO

With my intent of filtering trades for direction, reviewing a daily chart reveals a flaw with the approach of using the 200 day MA as a directional indicator. In a quiet/normal bull or bear market, it’s likely the price action will be close to the 200 day MA. When price moves more than 1SD in either direction from the 200 day MA, this reflects more of an extreme condition (irrational exuberance) than a normal bull or bear market.

The concept I’m trying to employ with the market filter is a directional filter: the trend is your friend. The 200 day MA approach doesn’t apply the bull, bear or sideways concept well. It’s more of a barometer for when the market is in extreme conditions. In quest for a better approach, I considered a concept of the RLCO – the slope of the river or the 30 period regression line (RL) of the daily chart. In conjunction with this, I applied another concept that I was experimenting with dubbed the DMZ. Combining the two together results in a concept hereintofore known as the RL-DMZ. Combining the DMZ together with the 30 period daily RL results in the following rules:

1. When the slope of the 30 day regression line is greater than .1, only long trades are taken.

2. When slope is between -.1 and .1, no trades are taken (the DMZ).3. When the slope is less than -.1, only short trades are taken.

I experimented with a few variations of this and replaced rule 2 with taking long or short trades in the DMZ, which ever trade came along. From testing, taking no trades in the DMZ dramatically improved expectancy.

Page 9: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

Applying this to APPL and EWZ resulted in an expectancy of .16 (484 total trades) and .12 (767 total trades) respectively. That is a dramatic increase in two Champs, 38% and 55% respectively. Although it decreased the number of trading opportunities considerably, this is a trade off I graciously accept.

Experimenting with this further, I found different symbols perform well with slightly different settings. For example, EWZ and AAL perform well with settings of a 5 day RL and a DMZ of +/- .2 slope.

The common element of the RL-DMZ concept is many symbols have a much higher expectancy when they are not in the DMZ. AAPL, EZW and AAL all perform significantly better when not in the DMZ. This concept even extends to most of the Chumps. Using the slope of the regression line to define market conditions, the DMZ is a sideways market in search of direction. It is lethal to expectancy for the Frog.

ADX Filter

Another concept I experimented with was the effect of ADX on the expectancy of the Frog. The idea being that the Frog in theory should perform best in trending markets. To test this, I used a filter on the daily price data. However an excellent article by Charles Lebeau (aka Saint Chuck):

http://www.tradingmarkets.com/recent/direction_is_the_key_to_using_adx_correctly-639297.html

details the flaw in using a raw ADX number as a measure of trend. Regardless, I proceeded to implement the ADX filter as a starting point for researching it’s effects on expectancy. I intend to investigate this further using the ideas outlined in Saint Chuck’s article. For testing the ADX, I used the default QF30 for these tests.

The results are interesting. For APPL, expectancy increased fairly proportional to the increase in ADX.

Page 10: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

EZW has the same trend – system expectancy increases as the ADX increases. The results for EZW are shown below.

Page 11: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

However a good number of symbols such as CAT, GS and BA display exactly the opposite trend: they perform best with a low ADX value and expectancy decreases in proportion to ADX. Below is a filter for the max ADX on GS. The other symbols display similar characteristics.

Page 12: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

With GS, using a ADX filter of 20 max increased the expectancy from .04 to .09. It also reduced the number of trades from 1568 to 498. Again this a tradeoff I happily accept.

The Frog Box Alchemy Experiment

The idea behind Ken’s FQN is that when the FQN is at 3.0, the range is very predictive: 2/3 of the average range over the last 30 days should be equal to 2 standard deviations. Because of math, we know that 3 standard deviations should equal the average range over the last 30 days. This means that a FQN of 3.5 is not necessarily better than a FQN of 2.5. A higher FQN value is not better, rather the closer the value is to 3.0, the better the system should perform.

Our Champs demonstrate the breakdown in correlation between FQN and expectancy. For AAPL, using a FQN filter between 2.7 and 3.3 reduced the expectancy to .09 from .12. Almost all other symbols display the same disconnect between FQN and expectancy. AAPL (with a few exceptions in the data) tends to perform best with a FQN below 2.6. The charts below show the effect of the minimum and maximum FQN on

Page 13: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

expectancy. The first chart is with the minimum FQN filter and the second the maximum FQN filter.

Page 14: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

This concept led me to experimenting with the size of the Frog box. Rather than using the Frog box size of 1 standard deviation of the range, what would happen if the Frog box size is the range divided by 3? This is essentially forcing the Frog box to be a perfect Frog specimen. Hence the Frog box alchemy experiment.

I was interested to see how varying the size of the Frog box performed in different market types. From the above chart of AAPL, I guessed the ideal Frog box divider for AAPL is somewhere between 2.2 and 2.6, since this is where it’s sweet spot is in the FQN tables. Meaning if the range is divided by between 2.2 and 2.6, this should be the ideal Frog box size for AAPL.

To test this, I created a custom version of QF30 that varied the Frog box divider (FBD) in the three different levels of volatility: quiet, normal and noisy. I then let Tradestation optimize the values for each volatility level as a staring point for analysis. My intent with this experiment was not to curve fit the FBD to AAPL, rather to see if there is a trend that applies to other symbols as well. With this experiment, some of the questions I’m looking to answer include:

1. Do noisy markets need a larger or smaller Frog box than a quiet market?

2. How about in normal volatility levels? 3. Is there a trend in the Frog box size between correlated symbols?

Running the optimization on AAPL results in a volatile frog box divider of 3.0, 2.3 for normal markets and 2.3 for quiet markets. In running the optimization, I picked a value that resulted in a greater expectancy by going up or down in the chart. For example, for the volatile divider of 3.0, going up to 3.1 or down 2.9 resulted in a higher expectancy than 3.0.

Using these values didn’t increase the expectancy of AAPL over the base QF30. However the trend is interesting: volatile markets prefer a larger Frog box divider (a smaller Frog box size). With a base trend, how would EWZ respond to these same values? Using the optimized 3/2.3/2.3 values on EWZ decreased the expectancy from .077 to .066.

Page 15: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

I was also curious how EWZ would optimize compared to AAPL, so I ran a FBD optimization on EWZ. The result is a bit shocking. Initially I varied the Frog box divider from 1.8 up to 4.0. However on EWZ, the first optimization revealed the expectancy was increasing significantly in direct proportion to the FBD increase and showed no signs of stopping at 4.0. So I re-ran the optimization and increased the upper limit from 4.0 to 10.

I spent a significant amount of time experimenting with this. After experimenting with different values, I found a grouping that seems to work well on many tech symbols (GOOG, FB, PCLN, TSLA and AMZN). It’s the 5.2/2.4/4.2 trifecta. It makes a dramatic improvement in expectancy on the above symbols. However the degrees of freedom around these values reveal the trifecta is a house of cards: it’s a random coincidence more than a tradable idea.

There is definitely something to varying the Frog box divider in different market conditions. There is a trend that increasing the divider in noisy markets increases system expectancy and 2.2 – 2.4 works well across the board in normal market volatility. However only our Champs are stable around these values and varying them slightly has little impact on system performance. Where as the other symbols are highly sensitive to the degrees of freedom of the FBD values. Until I can correlate the relationship, the Frog box divider isn’t a tradable idea.

Conclusion

My PowerPoint presentation will tie everything together and summarize my key ideas.

Page 16: Tortoise Capital Management – win the racetortoisecapital.net/.../Mechanized_Frog_Project_Rough3.docx · Web viewAppendix A is a screenshot of how AAPL and EWZ perform in the different

Appendix A – AAPL and EZW performance by market and volatility type