Global Net Liquidity - Dow Jones Global Fair Value
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © dharmatech

//@version=5

indicator("Global Net Liquidity - Dow Jones Global Fair Value Bands", overlay = true)

line_fed   = request.security("FRED:WALCL",                     "D", close, currency = currency.USD)
line_japan = request.security("FRED:JPNASSETS * FX_IDC:JPYUSD", "D", close, currency = currency.USD)
line_china = request.security("CNCBBS         * FX_IDC:CNYUSD", "D", close, currency = currency.USD)
line_uk    = request.security("GBCBBS         * FX:GBPUSD",     "D", close, currency = currency.USD)
line_ecb   = request.security("ECBASSETSW     * FX:EURUSD",     "D", close, currency = currency.USD)
line_rrp   = request.security("RRPONTSYD",                      "D", close, currency = currency.USD)
line_tga   = request.security("WTREGEN",                        "D", close, currency = currency.USD)

total = (line_fed + line_japan + line_china + line_uk + line_ecb - line_rrp - line_tga)

fv = total / 1000 / 1000 / 1000 * 0.03 - 350

upper = fv + 30
lower = fv - 45

plot(series=upper, title = 'Upper Band', color = color.red)
plot(series=fv,    title = 'Fair Value', color = color.orange)
plot(series=lower, title = 'Lower Band', color = color.green)