## ########################################################
#ToS OnBalanceVolumeModified
## ########################################################
declare lower;
declare real_size;
DefineGlobalColor("bull", Color.green) ;
DefineGlobalColor("bear", Color.red) ;
DefineGlobalColor("crossup", Color.cyan) ;
DefineGlobalColor("crossdn", Color.magenta) ;
input signalLength = 10;
input averageType = "exponential" ;
plot obvm = OnBalanceVolumeModified().obVM;
plot ema = OnBalanceVolumeModified("signal length" = signalLength, "average type" = averageType).Signal; ;
addcloud(obvm, ema, GlobalColor("bull"), GlobalColor("bear"));
plot crossUP = if obvm crosses above ema then ema else double.NaN ;
crossUP.SetPaintingStrategy(PaintingStrategy.ARROW_up);
crossUP.SetDefaultColor(GlobalColor("crossup")) ;
crossUP.SetLineWeight(3);
plot crossDN = if obvm crosses below ema then obvm else double.NaN ;
crossDN.SetPaintingStrategy(PaintingStrategy.ARROW_down);
crossDN.SetDefaultColor(GlobalColor("crossdn")) ;
crossDN.SetLineWeight(3);
input showLabel = yes ;
AddLabel(showLabel,
if obvm crosses above ema then "obv cross up!" else
if obvm crosses below ema then "obv cross down!" else
if obvm > ema then "obv trending above" else " | obv trending below",
if obvm crosses above ema then GlobalColor("crossup") else
if obvm crosses below ema then GlobalColor("crossdn") else
if obvm > ema then GlobalColor("bull") else GlobalColor("bear"));
input paintCandles = yes ;
AssignPriceColor(
if !paintCandles then color.current else
if obvm crosses above ema then GlobalColor("crossup") else
if obvm crosses below ema then GlobalColor("crossdn") else
if obvm > ema then GlobalColor("bull") else GlobalColor("bear"));