RicardoSantos

[RS]Dollar Composite Index V0

EXPERIMENTAL:
Majors equally weighted Dollar index .
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]Dollar Composite Index V0', shorttitle='DCI')
INVERT = input(false)
range = cum(close-close[1])
f_composite(_tf, _src)=>
    _eurusd = security('EURUSD', _tf, -_src)
    _gbpusd = security('GBPUSD', _tf, -_src)
    _audusd = security('AUDUSD', _tf, -_src)
    _usdjpy = security('USDJPY', _tf, _src)
    _usdcad = security('USDCAD', _tf, _src)
    _usdchf = security('USDCHF', _tf, _src)
    _return = (_eurusd + _gbpusd + _audusd + _usdjpy + _usdcad + _usdchf)/6

v_close = INVERT ? -f_composite(period, cum(close/close[1])) : f_composite(period, cum((close-close[1])/close))
v_high = INVERT ? -f_composite(period, cum(high/high[1])) : f_composite(period, cum((high-high[1])/high))
v_low = INVERT ? -f_composite(period, cum(low/low[1])) : f_composite(period, cum((low-low[1])/low))

plotcandle(v_close[1], v_high, v_low, v_close, title='DCI', color=change(v_close)>=0?lime:red)

Comments

Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out