Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion links/24h_volume.pine.link
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// 24h volume
currency = "USD"
curr_rate_usd = request.currency_rate(syminfo.currency, currency, ignore_invalid_currency = true)

msIn24h = 24*60*60*1000
countOfFiveMinsInDay = 24*60/5
maxBufferSize = 2*countOfFiveMinsInDay
Expand All @@ -22,7 +24,7 @@ sum24hVol(src) =>
var cumVol = 0.
cumVol += nz(volume)
expr = syminfo.volumetype == "quote" ? volume : ( syminfo.volumetype == "base" ? close * volume : na )
vol24h = request.security(syminfo.tickerid, sumVolTF, sum24hVol(expr * request.currency_rate(syminfo.currency, currency, ignore_invalid_currency = true)), ignore_invalid_symbol = true)
vol24h = request.security(syminfo.tickerid, sumVolTF, sum24hVol(expr * curr_rate_usd), ignore_invalid_symbol = true)
if barstate.islast
if syminfo.volumetype == "tick" and syminfo.type == "crypto" or cumVol == 0
vol24h := na
Expand Down Expand Up @@ -82,3 +84,8 @@ if na(close24hChangeAbs) or close24hPrevToCompare == 0 or (close24hPrevToCompare
else
close24hChange := (close24hChangeAbs / math.abs(close24hPrev)) * 100
plot(close24hChange, title = "24h_close_change", style = plot.style_columns)


// study("close_usd")
close_usd = curr_rate_usd * close
plot(close_usd, "close_usd")