• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Decoding Markets

  • Top Posts
  • Courses
  • Resources
    • Books
  • Free Class
  • Blog
You are here: Home / Amibroker / Market Meanness Index For Amibroker

September 21, 2018 By Joe Marwood 6 Comments

Market Meanness Index For Amibroker

The Market Meanness Index is a technical indicator developed by JCL from the Financial Hacker website. In this article we will describe what the indicator is designed to do and provide some code for Amibroker users.

MMI is a statistical algorithm based on the median value of a price series. It’s purpose is to help detect whether the market is in a trending mode or range mode. It therefore provides traders with an excellent filter for trend following strategies. If the market is not trending then you can save yourself some money and skip the signal coming from your trend system.

Understanding The Market Meanness Index

As stated by the author. the Market Meanness Index is based on a statistical fact – a series of random numbers will revert to the median with a probability of 75%. This is because, by definition, half the series of prices will be below the median and half will be above. Therefore, if a market is not moving in a similar pattern, prices are not random and more likely to be trending.

According to its creator, MMI can’t be used to predict price movement, it’s only used to detect whether ‘trend is trending’ and therefore whether a trend signal has a good chance of being profitable or not.

JCL suggests that MMI should be calculated over a minimum of 200 bars and smoothed with a low pass filter or similar low lag moving average.

A perfectly efficient market (with random price sequences) would return an MMI value of around 75%. Therefore, a falling MMI value that is under 75% suggests an inefficient market and is a good indicator of a real trend. Meanwhile, a rising MMI suggests that the market is becoming more efficient and the trend is becoming unsustainable.

In the following chart, you can see a 200-period MMI plotted below Apple stock. You can see that the MMI (orange) begins to decline since July just as Apple starts an upward trend. This is quite a nice example of the MMI in action:

MMI indicator on Apple stock
MMI indicator on Apple stock. Chart: Amibroker.

Market Meanness Code And Calculations

With some help from Matt Radtke we have put together some Amibroker code for the Market Meanness Index as below:

To better understand how this indicator works it’s a good idea to consider the following couple of worksheets that were used to create this indicator. You can click the images themselves to get a better view.

In the worksheets, columns H through K contain the calculations used to create MMI for the price series up to July 10, 2018. Similarly, columns L-O calculate MMI for July 9th, and so on.

So in this first worksheet, you will see that we have a price series of random numbers in column F. MMI has been calculated on this random data and the resulting values are shown for six different date ranges. The MMI is shown in columns K, O, S, W, AA and AE.  You can see that we are returning MMI values between 68 and 84 based on this random data series.

Market Meanness Index calculation worksheet random

Now in this next worksheet, we have replaced the random price series with a trending series. You can see now that we have a perfect price trend in column F starting at a value of 100 and ending in 125. And you can see that the MMI value for this perfect trend is 52.63.

Market Meanness Index calculation worksheet for trend

In other words, a random market produces a MMI value around 70-80 while a solid trend produces a MMI around 53.

Finally, in the next sheet you can see some calculations for real SPY data. Notice that the MMI fluctuates from 58 to 68.

In other words, SPY during this date range is not showing complete randomness but it isn’t showing a strong trend either.

Market Meanness Index calculation worksheet for SPY

Market Meanness In Action

The idea of the MMI indicator is to filter out trend signals that have a poor chance of success. It is used to find the best trending market environments.

I have briefly used this indicator on US equity markets on it’s own and by smoothing the indicator with an EMA and also an ALMA (Arnaud Legoux Moving Average) as suggested by the author.

I found that the MMI does improve some simple trend following strategies that I tried. However, I have a feeling it may be better suited to currency markets and higher timeframes.

I need to spend more time with this indicator but so far it does look promising as a trend filter. Take it for a spin and let me know what you think.


Thank You For Reading

joe marwood profile pictureJoe Marwood is an independent trader and the founder of Decoding Markets. He worked as a professional futures trader and has a passion for investing and building mechanical trading strategies. If you are interested in more quantitative trading strategies, investing ideas and tutorials make sure to check out our program Marwood Research.


Disclaimer

This post expresses the opinions of the writer and is for information, entertainment purposes only. Joe Marwood is not a registered financial advisor or certified analyst. The reader agrees to assume all risk resulting from the application of any of the information provided. Past performance is not a reliable indicator of future returns and financial trading is full of risk. Margin trading can lead to losses more than in your account. Mistakes in backtesting and presenting of analysis regularly occur. Please read the Full disclaimer.

Filed Under: Amibroker, Strategies/ Systems, Technical Analysis Tagged With: amibroker, trading systems, Trend Following

Recommended Educational Resources:


  • Discover New Trading Strategies
  • Learn Japanese Candlesticks (Free)
  • Mental Models For Trading (Free)
  • Indicators For Amibroker (Free)
  • Tools For Options Traders (Free)
  • Historical Data For 8000 Stocks (Free)

Reader Interactions

Comments

  1. Parth says

    October 27, 2018 at 3:03 am

    Some reason, it is showing a black chart (all values zero), please help

    Reply
    • Joe Marwood says

      October 27, 2018 at 4:45 pm

      Sorry but need more info. It is working as shown for me and others who have downloaded it. Make sure there are no formatting issues.

      Reply
  2. JimmyV says

    April 9, 2019 at 3:38 pm

    Hi, Joe. I found this to be an interesting indicator concept. Based on your last couple sentences in article about MMI, wondering if you had spent more time investigating this indicator. Thanks.

    Reply
    • Joe Marwood says

      April 10, 2019 at 9:42 am

      No I haven’t looked at it since I wrote this as I moved on to some other things, cheers.

      Reply
  3. Alberto says

    June 2, 2020 at 4:52 am

    Hi,
    sorry to bother you. Could it be possible to take a look at the formulas in the spreadsheet? I would like to replicate the calculations on Excel.
    Thanks a lot and congratulations on a fantastic site!
    Alberto

    Reply
    • Joe Marwood says

      June 8, 2020 at 10:28 pm

      I will have a look for it.

      Reply

Leave a Reply Cancel reply

Your email address will not be published.

Primary Sidebar

Access Marwood Research image

Popular

Apple DCA equity chart

How To Build A $2.5 Million Position In Apple Stock (With $500 A Month)

technical analysis for stocks

Technical Analysis For Stocks Essential Guide

Performance Of Our Trading Systems In 2019

low priced stocks analysis

Should You Buy Low Priced Stocks?

beware youtube trading videos

Beware YouTube Trading Videos

10 things that dont work trading stocks featured image

10 Mistakes To Avoid When Trading Stocks

Which Trailing Stop Is The Best?

Double top pattern with adjustable parameters

Double Top Pattern – Backtest Rules & Results

Search

Recommended Resources

  • Discover New Trading Strategies
  • Learn Japanese Candlesticks (Free)
  • Mental Models For Trading (Free)
  • Indicators For Amibroker (Free)
  • Tools For Options Traders (Free)
  • Hist. Data For 8000 Stocks (Free)

Financial Disclaimer

Financial trading is risky and you can lose money. Joe Marwood is not a registered investment advisor and nothing on this site is to be regarded as personalized investment advice. Past performance is not indicative of future results. Data errors and mistakes do occur. Please see the full disclaimer.

Footer

About The Author

Joe Marwood is an independent trader and investor specialising in financial market analysis and trading systems. He worked as a professional futures trader for a trading firm in London and has a passion for building mechanical trading strategies. He has been in the market since 2008 and working with Amibroker since 2011.

Joe Marwood Profile PIc

Recent Posts

  • Performance Of Our Trading Systems In 2020
  • Trend Following With ETFs and Large Cap Stocks
  • Should You Trade This Earnings Pullback Strategy?
  • Simple Algo Trading With Alpaca And Streak
  • Is Value Investing Dead? Dissecting The Value Investing Narrative
  • How To Screen For Stocks With Norgate Data
  • Do Stocks Have A Floor?
  • What Trading Signals Work Best For Long-Term Investors?

Search

Privacy policy | Contact | Disclaimer | All Rights reserved. JB Marwood.