RicardoSantos

[RS]TEST PredictiveMA

simple yet efficient predictive algorithm applied to moving averages
Remove from Favorite Scripts Add to Favorite Scripts
study("[RS]PMA", overlay=true)
useDEMA = input(true)

src = input("close")
source = src == "close" ? close : 
        src == "open" ? open :
        src == "high" ? high : 
        src == "low" ? low : 
        src == "ohlc4" ? ohlc4 : 
        src == "hlc3" ? hlc3 : 
        src == "hl2" ? hl2 : close

length1 = input(4)
length2 = input(12)
length3 = input(24)
length4 = input(48)
length5 = input(72)
length6 = input(120)
length7 = input(240)
length8 = input(360)
length9 = input(576)

term1 = ema(ema((sum(source, length1)/length1) + change(source, length1), length1), useDEMA ? length1 : 1)
term2 = ema(ema((sum(source, length2)/length2) + change(source, length2), length2), useDEMA ? length2 : 1)
term3 = ema(ema((sum(source, length3)/length3) + change(source, length3), length3), useDEMA ? length3 : 1)
term4 = ema(ema((sum(source, length4)/length4) + change(source, length4), length4), useDEMA ? length4 : 1)
term5 = ema(ema((sum(source, length5)/length5) + change(source, length5), length5), useDEMA ? length5 : 1)
term6 = ema(ema((sum(source, length6)/length6) + change(source, length6), length6), useDEMA ? length6 : 1)
term7 = ema(ema((sum(source, length7)/length7) + change(source, length7), length7), useDEMA ? length7 : 1)
term8 = ema(ema((sum(source, length8)/length8) + change(source, length8), length8), useDEMA ? length8 : 1)
term9 = ema(ema((sum(source, length9)/length9) + change(source, length9), length9), useDEMA ? length9 : 1)

colorf(pt0, pt1) => pt0 >= pt1 ? teal : navy
offsetf(v) => 1+round(v/2)

p1 = plot(term1, color=colorf(term1, term2), offset=offsetf(length1), linewidth=1)
p2 = plot(term2, color=colorf(term2, term3), offset=offsetf(length2), linewidth=2)
p3 = plot(term3, color=colorf(term3, term4), offset=offsetf(length3), linewidth=3)
p4 = plot(term4, color=colorf(term4, term5), offset=offsetf(length4), linewidth=4)
p5 = plot(term5, color=colorf(term5, term6), offset=offsetf(length5), linewidth=5)
p6 = plot(term6, color=colorf(term6, term7), offset=offsetf(length6), linewidth=6)
p7 = plot(term7, color=colorf(term7, term8), offset=offsetf(length7), linewidth=7)
p8 = plot(term8, color=colorf(term8, term9), offset=offsetf(length8), linewidth=8)
p9 = plot(term9, color=colorf(term9, term1), offset=offsetf(length9), linewidth=9)
How do i use it, what are the rules?
Reply
@obstak, it works of the assumption that price eventually returns to its average price, beyond that you will have to do your own homework.
Reply
United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
中国
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out