update: added hour and minute support (request for 56SD1uijk)
issues: usdrub is from a different data provider, reason why its desync'd with the other instruments intraday.
issues: usdrub is from a different data provider, reason why its desync'd with the other instruments intraday.
study(title='[RS]The Great Dollar Basket V2', overlay=false) yyyy = input(title='Year:', type=integer, defval=2015) mm = input(title='Month:', type=integer, defval=08, minval=1, maxval=12) dd = input(title='Day:', type=integer, defval=01, minval=1, maxval=31) hh = input(title='Hour:', type=integer, defval=00, minval=0, maxval=23) mi = input(title='Minute:', type=integer, defval=00, minval=0, maxval=59) src = input(title='Source:', type=source, defval=close) smooth = input(title='Signal Smoothing:', type=integer, defval=1) SHOW_XXXUSD = input(title='Show XXXUSD instruments:', type=bool, defval=true) SHOW_USDXXX = input(title='Show USDXXX instruments:', type=bool, defval=true) SHOW_METAL = input(title='Show Metal instruments:', type=bool, defval=true) SHOW_OIL = input(title='Show Oil and Gas instruments:', type=bool, defval=true) SHOW_INDEX = input(title='Show Index instruments:', type=bool, defval=true) f_get_percentual_src(_yyyy, _mm, _dd, _hh, _mi, _srctype)=> //--> remove data prior to date. _src = year < _yyyy or (year <= _yyyy and month < _mm) or (year <= _yyyy and month <= _mm and dayofmonth < _dd) or (year <= _yyyy and month <= _mm and dayofmonth < _dd and _hh < hour) or (year <= _yyyy and month <= _mm and dayofmonth < _dd and _hh <= hour and _mi < minute) ? na : _srctype _basis_ad = valuewhen( na(_src[1]), _src, 0) _return = (_src/_basis_ad)*100 mod_src = smooth <= 1 ? src : ema(src, smooth) eurusd = not SHOW_XXXUSD ? na : security('EURUSD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) gbpusd = not SHOW_XXXUSD ? na : security('GBPUSD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) audusd = not SHOW_XXXUSD ? na : security('AUDUSD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) nzdusd = not SHOW_XXXUSD ? na : security('NZDUSD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) usdjpy = not SHOW_USDXXX ? na : security('USDJPY', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) usdcad = not SHOW_USDXXX ? na : security('USDCAD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) usdcnh = not SHOW_USDXXX ? na : security('USDCNH', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) usdchf = not SHOW_USDXXX ? na : security('USDCHF', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) usdrub = not SHOW_USDXXX ? na : security('USDRUB', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) xauusd = not SHOW_METAL ? na : security('XAUUSD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) xagusd = not SHOW_METAL ? na : security('XAGUSD', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) oilusd = not SHOW_OIL ? na : security('USOIL', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) gasusd = not SHOW_OIL ? na : security('NGAS', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) dxy = not SHOW_INDEX ? na : security('DXY', 'D', f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) usd = not SHOW_INDEX ? na : security('USDOLLAR', period, f_get_percentual_src(yyyy, mm, dd, hh, mi, mod_src)) plot(title='EURUSD', series=eurusd, color=blue) plot(title='GBPUSD', series=gbpusd, color=aqua) plot(title='AUDUSD', series=audusd, color=teal) plot(title='NZDUSD', series=nzdusd, color=navy) plot(title='USDJPY', series=usdjpy, color=orange) plot(title='USDCAD', series=usdcad, color=olive) plot(title='USDCNH', series=usdcnh, color=purple) plot(title='USDCHF', series=usdchf, color=fuchsia) plot(title='USDRUB', series=usdrub, color=lime) plot(title='XAUUSD', series=xauusd, color=yellow) plot(title='XAGUSD', series=xagusd, color=silver) plot(title='OIL', series=oilusd, color=black) plot(title='GAS', series=gasusd, color=gray) plot(title='DXY', series=dxy, color=maroon) plot(title='USDOLLAR', series=usd, color=red) hline(title='100', price=100, color=black)