RicardoSantos

[RS]Temporal Open Diferential V0

68 0 5
EXPERIMENTAL: Diferencial from Opening "Timeframe" Price
Remove from Favorite Scripts Add to Favorite Scripts
study("[RS]Temporal Open Diferential V0")
otracker = input(title='Open Timeframe:', defval='M', type=string)
src = input(title='Source:', type=source, defval=hl2)
SHOW_MA = input(title='Show Slow Moving Average:', type=bool, defval=true)
smooth = input(2)
MA_length = input(8)
SHOW_HHL = input(title='Show Historic Extremes:', type=bool, defval=true)

newbar(res)=>change(time(res)) != 0

track = sma(src - security(tickerid, otracker, open), smooth)
ma = sma(track, MA_length)
track_color = track > 0 and rising(track, 1) ? green: track>0?olive : track < 0 and falling(track, 1) ? maroon : track < 0 ? orange : gray

hline(0, color=black)
plot(track, style=columns, color=track_color)
plot(not SHOW_MA ? na : ma, color=black)
plot(newbar(otracker)?0:na, style=cross, color=black, linewidth=3)

hh=not SHOW_HHL ? na : na(track)? 0 : track >= hh[1] ? track : hh[1]
ll=not SHOW_HHL ? na : na(track)? 0 : track <= ll[1] ? track : ll[1]

plot(not SHOW_HHL ? na : hh, color=hh == hh[1]?black:na)
plot(not SHOW_HHL ? na : ll, color=ll == ll[1]?black:na)
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out