Skip to content

Commit

Permalink
HBS-0: change mbb to magic for 24h volume pine
Browse files Browse the repository at this point in the history
  • Loading branch information
stimofeev-tv committed Feb 21, 2024
1 parent 639ff9f commit e6020a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions links/24h_volume.pine.link
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ maxBufferSize = 2*countOfFiveMinsInDay
cumVolTF = "5"
expr(offset, maxBufferSize) =>
if (syminfo.volumetype == "quote")
max_bars_back(volume, maxBufferSize)
volume[offset]
// max_bars_back(volume, maxBufferSize)
volume[offset] + 0 * volume[maxBufferSize]
else
if syminfo.volumetype == "base"
max_bars_back(close, maxBufferSize)
max_bars_back(volume, maxBufferSize)
close[offset] * volume[offset]
// max_bars_back(close, maxBufferSize)
// max_bars_back(volume, maxBufferSize)
close[offset] * volume[offset] + 0 * close[maxBufferSize] * volume[maxBufferSize]
else
na

cum24hVol() =>
max_bars_back(time, maxBufferSize)
var cumSum = 0.
// max_bars_back(time, maxBufferSize)
var cumSum = 0. * time[maxBufferSize]
var int firstBarTimeIndex = na
if na(firstBarTimeIndex) // 24 H have not elapsed yet
sum = 0.
Expand Down Expand Up @@ -51,16 +51,16 @@ plot(volQuote, title = "volume_quote", style = plot.style_columns)
// 24h prev value (generic)
prev24hVal(source) =>
src = source
max_bars_back(src, maxBufferSize)
max_bars_back(time, maxBufferSize)
// max_bars_back(src, maxBufferSize)
// max_bars_back(time, maxBufferSize)
int BB24h = na
for i = 0 to countOfFiveMinsInDay
if (time - time[i]) >= msIn24h
if (time - time[i]) == msIn24h
BB24h := i
break
BB24h := i
src[BB24h]
src[BB24h] + 0 * src[maxBufferSize] * time[maxBufferSize]

// 24h vol prev value
vol24hPrev = prev24hVal(vol24h)
Expand Down
Loading

0 comments on commit e6020a3

Please sign in to comment.