SAT2021-13 Kaufman’s Efficiency Ratio 1

Wow, thirteen ideas, thirteen weeks, one quarter of a year, and three months.  This week’s idea was the most difficult to define yet.  It was so difficult that I needed an additional week to determine if I even had an idea that could be traded. 

This week I will be using Perry Kaufman’s Efficiency Ratio (ER), which is an indicator designed to show the ‘trendiness’ of an instrument, or lack of trendiness.  You can learn more about it in the Resources section at the end, but the essence of this indicator is:

  • 0 = no trend; perfectly flat
  • 1 = perfect trend

It has been written that the ER never reaches 0 or 1, but I say: “Never say never”.  Pictures are better than words, and March 15th, 2020 provides our best example of the ER showing a perfect trend and no trend within the same session (indicator calculation length = 10 bars):

You will notice that the ER is not directional and has the same function as the ADX.  For this idea, I will calculate the ER and determine the current trend direction based on the same calculation: I call it Trend_ER.  Here are some simple rules:

  • When Trend_ER is up and pushes into extremes, e.g. ER >= .8, then go short
  • When Trend_ER is down and pushes into extremes, e.g. ER <= -.8, then go long

If you are saying to yourself, ‘Mark is trying to catch a top’, you are correct.  This is a trend reversal trade.  I will utilize an initial Average True Range (ATR) based stop loss and then use a trailing ATR stop once profitable.  That is about the best I can do.

The difficulty I had with this idea is simply this: I did not think it would work and I did not want to show an idea that did not even pass our Manual Test, Step 5.  After a lot of thought, I remember that this site is dedicated to showing the process, even early failures.  Our process is designed to start weeding out bad ideas early.  The manual test for this idea is going to be a little different, so stay with me.

Phase 1: Plan & Design

1. Trading Idea

The idea is simple:

  • Buy when the Trend_ER reaches an extreme low and turns back up
  • Sell short when the Trend_ER reaches an extreme high and turns back down

Sometimes Trend_ER will linger in the extreme.  I want a commitment from Trend_ER that prices may be reversing before I put my money into the trade.  I will optimize the extreme high and low levels, but only gently.

Chart showing Trend Efficiency Ratio in extreme, triggering a short trade, and exiting with an average true range trailing stop

2. System Definition

Position Sizing:

I will use the following position sizing:

  • Futures:  1 contract

Entry:

  • Long:
    • If Trend_ER[1 bar ago] <= Low_Extreme and
    • Trend_ER > Trend_ER[1 bar ago]
    • Buy next bar at market
  • Short:
    • If Trend_ER[1 bar ago] >= High_Extreme and
    • Trend_ER < Trend_ER[1 bar ago]
    • Sell short next bar at market

If the entries seem strange because I am looking at Trend_ER of one bar prior, recall that I want to wait one bar after the extreme until the Trend_ER starts to move in the next direction.

  • Profit targets: None
  • Stop Loss: 1 ATR (initial), ATR calculated on 10 bars
  • Trailing Stop:
    • Multiple of ATR after we are profitable
    • I will use a different multiple of ATR for long and short, as I believe/think/know that shorts and longs rarely behave in the same manner

Note: ATR = Average True Range

I will use the following input parameters:

Input(Default)Data TypeOptimizable?Comments
ER_Length(10)IntergerYesNumber of bars used to calculate Efficiency Ratio
Low_Extreme(-.8)DoubleYesThe level ER must close beneath to trigger a long entry
High_Extreme(.8)DoubleYesThe lever ER must close above to trigger a short entry
ATR_Mult_Long(3)DoubleYesATR multiple for trailing stop on longs
ATR_Mult_Short(3)DoubleYesATR multiple for trailing stop on shorts

Variables:

VariableData TypeDefaultCalculation
Trend_ERDouble0This is the Efficiency Ratio, but calculated with a trend direction (see Resources section for references)
PosHighDouble0The highest high when in a long position, used to calculate trailing stop
PosLowDouble0The lowest low when in a short position, used to calculate trailing stop

Challenges:

None.

3. Performance Objectives

The system will meet the following objectives:

ObjectiveGoal
System Type (trend, mean-reversion, day, swing, etc.)I honestly don’t know, but it feels like a Swing or Trend system
Walk-forward Efficiency> 50%
Risk of Ruin0%
Profit Factor>= 1.5
Win Percent>= 0%
Max Drawdown %< 35%
Profit/Max Drawdown Ratio>= 2.0
Ready Date2021/04/30

This idea is S.M.A.R.T.: Specific, Measurable, Achievable, Realistic, Time-bound

4. Market Selection

Markets:

EnergiesCurrenciesFixed IncomeAgricultureMetalsSoftsIndexesEquities
XXXXXXX

Instruments:

Market GroupInstrumentSymbolComments
CurrencyFutures: Euro FX, Australian Dollars, Canadian Dollars, Japanese Yen, British PoundEC, AD, CD, JY, BP 
AgricultureSoft Red Wheat, Oats, Lean Hogs, Soybeans, CornW, O, LH, S, C 
MetalsSilver, Gold, Copper, Mini-SilverSI, GC, HG, YI 
Fixed IncomeU.S. 30-Year Treasury BondsUS, TY 
Index FuturesE-minis: S&P, Dow, Russell 2000, Nasdaq Micro E-Minis: S&P, Dow, Russell 2000, NasdaqES, YM, RTY, NQ   MES, MYM, M2K, MNQ 

Chart Type, Timeframe, Session, Time Zone:

AttributeValueComments
Chart TypeRegular CandlestickCharting is only useful for validating entry and exit signals
Timeframe / Interval(s)Daily, 5 min, 60 min, 240 min 
SessionRegular 
Time ZoneExchange 

Phase 2: Build

5. Manual Test

For a manual test, I usually perform manual calculations.  This week, I will be writing some base code first, applying it to several random instruments and timeframes, and seeing what happens.  Kevin Davey, award winning trader, author, and algorithmic trading educator, uses this approach to quickly test an idea to see if it is worth developing further.  He calls this ‘Preliminary’ testing.  I generally perform a manual test by hand, but decided to use Kevin’s approach this week.

I will use ES, RB, SI, TY, DX, and YM for this test and will test a random two year period from May 6, 2014 to May 5, 2016.

Results: Fail

For the test, I was looking for Iterations Profitable % to be greater than 70%.  The highest was RB (RBOB Gasoline) at 49%.  These numbers tell me that this system idea will likely fail. 

6. Build

Because I automated my Manual Test, I needed to diagram this since I was going to code it anyhow.  I learned my lesson last week: diagram the process before building.  This step usually comes after Manual Test, but since I used Kevin Davey’s preliminary test, I did out of order.  We follow a Continual Improvement Process in our organization, so we get incrementally better with each system we develop.

Process Diagram

Comments:

I like highly efficient code, especially since I am cranking out one system per week for this site.  I have noticed some other algo traders who have their ATR-based stops calculate the ATR every single bar.  If you look at the diagram, you will see that I calculate ATR only on a bar that I am entering or already in a position.  If I am in the market only 5% for a given system that uses ATR stops, I only need to calculate ATR 5% of the time.  This makes for a huge savings in CPU utilization and time, particularly with optimization and walk-forward analysis.

If you code, regardless of the language or platform, I suggest that you pay attention to how many times you calculate a variable.  Code is poetry, less is more.

7. Unit Test

After writing the code for the Manual Test, I performed my unit testing.  I found a couple of issues, fixed them, and then ran my test.

Complete?

Note: Unit Test verifies that the system is executing the trading rules correctly.  It is, essentially, quality control. It does not tell us if the system is profitable

Phase 3: Test

8. Optimization

We had a failure at Manual testing, so we can just skip ahead to the Notes and Commentary section. 

9. Walk-Forward Analysis

We did not make it this far.

10. Monte Carlo Simulation

We did not make it this far.

11. Incubation

We did not make it this far.

Phase 4: Deploy

We did not make it this far.

Overall Result: Fail

Notes and Commentary

Thanks for sticking with me to this point.  If you have ready my other posts, I may have confused you by changing the Manual Test.  To summarize, this is the order I performed things:

  • 5. Diagram > 6. Build > 7. Unit Test > 4. Manual Test

For purposes of clarity and to avoid confusion, future ideas will follow the original order.  Manual Testing is crucial for me to understand and identify the nuances of the idea, before committing anything to code.  The takeaway here is that there is not one single ‘correct’ way for trading system development. 

Can this system be improved?  Probably not.  The Trend ER has a lot of utility, I believe, but it is probably best when paired with another indicator or filter.  I will give this some more thought and maybe we will see the Trend ER in another system idea.  If nothing else, you will definitely see ER under the hood of some of the other system ideas that I will present.

I sincerely thank you for taking the time to read this article.  If you want to stay informed about each new trading idea I test, subscribe to my weekly newsletter (below).  If you have an idea you would like to build and test, feel free to leave a comment or reach me on the Comments page and we can discuss.

Next week’s idea: 40 In 20 Out: this one is going to be a doozy!

Sources/References

Did you like what you read? Do you want to see more?  Subscribe now and receive our weekly email, with the Trading System Idea of the Week and other fun stuff.

Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.

Did you like what you read? Do you want to see more?  Subscribe now and receive our weekly email, with the Trading System Idea of the Week and other fun stuff.

Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.

Leave a Reply

Your email address will not be published. Required fields are marked *