FTX spot/perp 24h volume ratio
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Thojdid
//This indicator gives the ratio between the 24h volume on the spot instrument versus the perpetual contract on FTX.
//Works on intraday timeframes only (minutes and hourly)
//@version=4
study("FTX spot/perp 24h volume ratio", overlay=false)

coin = input("BTC", title='coin')

vp1 = security("FTX:"+coin+"PERP","",volume)
vs1 = security("FTX:"+coin+"USD","",volume)

cum_vp1 = 0.0
cum_vs1 = 0.0
period = 1440/tonumber(timeframe.period)

for i = 0 to period
    cum_vp1 := cum_vp1 + vp1[i]
    cum_vs1 := cum_vs1 + vs1[i]

plot(cum_vs1/cum_vp1, color=color.green)