traileriana

Volume (D)EMA

A simple yet configurable indicator that shows recent traffic volumes.
The time period is specified as weeks/days/hours/minutes, not as bars.
Set the volume period to non-zero if you want to use a generalized double EMA instead of plain.
The "ratio" option will show the size of the current volume compared to the average volume as computed for the specified time period; say hello to fat tails and goodby to "standard" and "normal" and "average". With the "together" option, it compares the current volume to the both sides together (buy+sell), otherwise it compares it to just its respective side.
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?
//@version=2

// A simple yet configurable indicator that shows recent traffic volumes.
//
// The time period is specified as weeks/days/hours/minutes, not as bars.
//
// Set the volume period to non-zero if you want to use a generalized double EMA instead of plain.
//
// The ratio option will show the size of the current volume compared to the volume in the specified time period (expect to see something VERY non-Gaussian!)
// With "together" it compares it to the full volume, otherwise it compares it to just its own (buy or sell) side.

study("Volume (D)EMA")

pw = input(0.0,"Weeks")
pd = input(0.0,"Days")
ph = input(8.0,"Hours")
pm = input(0,"Minutes", minval=5, step=5)

iv = period == 'M' ? 30*24*60 : period == 'W' ? 7*24*60 : period == 'D' ? 24*60 : interval // current interval in minutes
p = max(1,round(7*24*60*pw + 24*60*pd + 60*ph +pm) / iv)

v = input(0.0, "DEMA Velocity", step=0.1)

gdema(x, p, v) =>
    e = ema(x, p)
    (1+v) * e - v * ema(e, p)

dema(x, p) => gdema(x, p, v)

bs0 = input(false, "Together")
neg = input(false, "Difference") ? -1 : 1


buy_  = dema(close > open ? volume*open : 0, p)
sell_ = dema(close < open ? volume*open : 0, p)

ra = input(false, "Ratio")

bs = bs0 or not ra and neg == -1

buy  = ra ? (close > open ? volume / ( buy_[1] + (bs ? sell_[1] : 0))  : 0) : buy_
sell = ra ? (close < open ? volume / (sell_[1] + (bs ?  buy_[1] : 0))  : 0) : sell_

bsv = bs ? nz(buy) + (ra ? 1 : neg) * nz(sell) : buy

plot(bs ? bsv : buy, style=columns, color = bsv < 0 or ra and close < open ? red : navy)
plot(bs ? na : -sell, style=columns, color = red)