A simple yet configurable indicator that shows recent traffic volumes.
The time period is specified as weeks/days/hours/minutes, not as bars.
For using the generalized double EMA, set the velocity to something other than zero.
The time period is specified as weeks/days/hours/minutes, not as bars.
For using the generalized double EMA, set the velocity to something other than zero.
//@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. 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 bs = bs0 or neg == -1 buy = dema(close > open ? volume*open : 0, p) sell = dema(close < open ? volume*open : 0, p) bsv = buy + neg * sell plot(bs ? bsv : buy, style=columns, color = bsv < 0 ? red : navy) plot(bs ? na : -sell, style=columns, color = red)