I'm trying to plot BTC over the M1 money supply, but without a coefficient, it is hard to compare the result to the current BTC price. So I'm looking to multiply the result by a coefficient based on today's value of M1.
It works great if I set a hardcoded variable, in this example 6741, but once I uncomment the 2 lines below it uses "current" price at the time of calculation and not "today's" price which is the one I need. Please advise
//@version=4
study("BTC/M1", overlay=true)
var float coefficient = 6741
// ignore the multiplication & division by COINBASE:BTCUSD, it's a TradingView workaround
// temp = security("FRED:M1 * COINBASE:BTCUSD / COINBASE:BTCUSD", "D", close, true)
// coefficient := temp[0]
cc = security("COINBASE:BTCUSD/FRED:M1", timeframe.period, close, true)
plot(cc * coefficient)
question from:
https://stackoverflow.com/questions/65835294/how-to-get-todays-not-current-price-of-the-unrelated-security-in-the-pinescri 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…