LevyFlight

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.

สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
//@version=2
study("MMI-Price Changes")
// Set Inputs
inputLength=input(300)
topband=input(76)
bottomband=input(74)

// 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])
        else
            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
        else
            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)
    
u=plot(topband)
l=plot(bottomband)
t=plot(90)
b=plot(60)
fill(u,l,black)
fill(t,u,yellow)
fill(b,l,blue)
plot(MMI(open,close,inputLength))