Market Meanness Index-Price Changes

This is the Market Mean index. It is used to identify if the market is really trending or if it is range bound(random). In theory, a random sample will be mean reverting 75% of the time. This indicator checks to see what how much the market is mean reverting and converts it to a percentage. If the index is around 75 or higher than the price curve of the market is range bound and there is no trend from a statistical standpoint. If the index is below 75 this means the price curve of the market is in fact trending in a direction as the market is not reverting as much as it should if it were truly following a random/range bound price curve.
Remove from Favorite Scripts Add to Favorite Scripts
study("MMI-Price Changes")
// Set Inputs

// Get Average Price Change
mean(price1, price2, length) =>
    sum = 0
    for i = 0 to length
        if price1[i] - price2[i] > 0
            sum := sum + (price1[i] - price2[i])
            sum := sum + (price2[i] - price1[i])
    sum / length

// Market Meaness Index Function
MMI(price1,price2, length) =>
    m = mean(open,close,inputLength)
    nh = 0
    nl = 0
    for i = 1 to length
        if price1[i] - price2[i] > 0
            if (price1[i] - price2[i]) > m
                if (price1[i] - price2[i]) > (price1[i+1] - price2[i+1])
                    nl := nl + 1
            if (price2[i] - price1[i]) < m 
                if (price2[i] - price1[i]) < (price2[i+1] - price1[i+1])
                    nh := nh + 1
    100 - 100*(nl + nh)/(length - 1)
Hi LevyFlight,
thanks for sharing this.

Is it normal that in DAX the value never go above 75 in more than 10 years?
Thank you for making this!
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out