Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...