RicardoSantos

test-mtfbias-overlay

EXPERIMENTAL:
Artsy way to look at market fractality flow at intraday levels :D
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//@version=2
study(title='test-mtfbias-overlay', overlay=true)
tf00 = input(title='Timeframe 00:', type=string, defval='D', confirm=false)
tf01 = input(title='Timeframe 01:', type=string, defval='720', confirm=false)
tf02 = input(title='Timeframe 02:', type=string, defval='360', confirm=false)
tf03 = input(title='Timeframe 03:', type=string, defval='240', confirm=false)
tf04 = input(title='Timeframe 04:', type=string, defval='60', confirm=false)
tf05 = input(title='Timeframe 05:', type=string, defval='30', confirm=false)

f_query_sec(_tf)=>security(tickerid, _tf, open)

s00 = f_query_sec(tf00)
s01 = f_query_sec(tf01)
s02 = f_query_sec(tf02)
s03 = f_query_sec(tf03)
s04 = f_query_sec(tf04)
s05 = f_query_sec(tf05)

q00 = close >= s00
q01 = close >= s01
q02 = close >= s02
q03 = close >= s03
q04 = close >= s04
q05 = close >= s05

pos01 = s01 >= s00 ? s01 : na
pos02 = s02 >= s01 ? s02 : na
pos03 = s03 >= s02 ? s03 : na
pos04 = s04 >= s03 ? s04 : na
pos05 = s05 >= s04 ? s05 : na

neg01 = s01 <= s00 ? s01 : na
neg02 = s02 <= s01 ? s02 : na
neg03 = s03 <= s02 ? s03 : na
neg04 = s04 <= s03 ? s04 : na
neg05 = s05 <= s04 ? s05 : na

b00 = plot(title='B00', series=change(s00)!=0?na:s00, style=linebr, color=q00?green:maroon)
b01 = plot(title='B01', series=change(s01)!=0?na:s01, style=linebr, color=q00?q01?green:gray:q01?gray:maroon)
b02 = plot(title='B02', series=change(s02)!=0?na:s02, style=linebr, color=q00?q02?green:gray:q02?gray:maroon)
b03 = plot(title='B03', series=change(s03)!=0?na:s03, style=linebr, color=q00?q03?green:gray:q03?gray:maroon)
b04 = plot(title='B04', series=change(s04)!=0?na:s04, style=linebr, color=q00?q04?green:gray:q04?gray:maroon)
b05 = plot(title='B05', series=change(s05)!=0?na:s05, style=linebr, color=q00?q05?green:gray:q05?gray:maroon)

p01 = plot(title='P01', series=change(pos01)!=0?na:pos01, style=linebr, color=q00?q01?green:gray:q01?gray:maroon)
p02 = plot(title='P02', series=change(pos02)!=0?na:pos02, style=linebr, color=q00?q02?green:gray:q02?gray:maroon)
p03 = plot(title='P03', series=change(pos03)!=0?na:pos03, style=linebr, color=q00?q03?green:gray:q03?gray:maroon)
p04 = plot(title='P04', series=change(pos04)!=0?na:pos04, style=linebr, color=q00?q04?green:gray:q04?gray:maroon)
p05 = plot(title='P05', series=change(pos05)!=0?na:pos05, style=linebr, color=q00?q05?green:gray:q05?gray:maroon)

n01 = plot(title='N01', series=change(neg01)!=0?na:neg01, style=linebr, color=q00?q01?green:gray:q01?gray:maroon)
n02 = plot(title='N02', series=change(neg02)!=0?na:neg02, style=linebr, color=q00?q02?green:gray:q02?gray:maroon)
n03 = plot(title='N03', series=change(neg03)!=0?na:neg03, style=linebr, color=q00?q03?green:gray:q03?gray:maroon)
n04 = plot(title='N04', series=change(neg04)!=0?na:neg04, style=linebr, color=q00?q04?green:gray:q04?gray:maroon)
n05 = plot(title='N05', series=change(neg05)!=0?na:neg05, style=linebr, color=q00?q05?green:gray:q05?gray:maroon)

fill(b00, p01, color=green, transp=0)
fill(b00, n01, color=maroon, transp=0)

fill(b01, p02, color=green, transp=0)
fill(b01, n02, color=maroon, transp=0)

fill(b02, p03, color=lime, transp=0)
fill(b02, n03, color=red, transp=0)

fill(b03, p04, color=lime, transp=0)
fill(b03, n04, color=red, transp=0)

fill(b04, p05, color=olive, transp=0)
fill(b04, n05, color=orange, transp=0)