Future Timevalue
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © deejay

//@version=4
study("Future Timevalue", shorttitle="Future Timevalue", format=format.inherit, precision=4, overlay=false)



    
// Add the script's inputs
symbolFut= syminfo.tickerid + "1!"  

maDuration = input(title="Moving Average", type=input.integer, defval=50)

gapFut = (security(symbolFut, '1', close))-(security(syminfo.tickerid, '1', close))

ma = sma(gapFut, maDuration)

hline(price=0, title="Median", color=color.white, linestyle=hline.style_dashed, linewidth=0)
// Plot a line
plot(series=gapFut, title="Timeval", color=color.red, style=plot.style_columns,linewidth=3)
plot(series=ma, color=color.blue,title="Timeval MA", style=plot.style_columns,linewidth=2)


