Enhanced Volume Indicator asking for help

I am not a programmer. Can someone help me write a formula for weekly volume on a weekly chart that will compare the volume to its 10 period sma and highlight (make highly visible) the volume bars that are both 1) above the 10sma and 2) the corresponding price bar is in the upper 50% of its true range; while making all the other volume bars that don't meet those 2 requirements less visible. I will use this formula by including it as a pane for my stocks watch list chart and scrolling through the list visually to see each stock's 'enhanced' volume characteristics. Thanks.

I had an old code to colour volume spikes.
Added the 50pc condition, but you have to verify if the code does what you want.
make sure you insert formula in a new pane.

Otherwise, you will have to use StyleOwnScale and set min size

_SECTION_BEGIN("Volume atr 50");
period = 10;
vol_ma = MA( V, period );

/* MA */
Vol_b = V > vol_ma;

/* ATR */
pc = Ref( C, -1 );
true_h = Max( H, pc);

atr1 = ATR( 1 );
atr1 = atr1 * 0.5;

// 50 pc of ATR subtracted from atr H
tr_50pc = true_h - atr1;
tr_50pc = IIf( C > tr_50pc, 1, 0 );

both_cond = Vol_b AND tr_50pc;

vol_col = IIf( both_cond, colorLightBlue, colorDarkBlue );

Plot( V, "V", vol_col , styleHistogram );

_SECTION_END();

1 Like

Thank you very much! It worked great in a new pane. I would like to add the plot of the sma10? That way I can confirm visually that there's above average volume when the price bar closes in the upper half of its true range. I know enough to be able to change the color of the enhanced volume bars so I made them red to contrast with the light blue bars. I really appreciate your help!


:pray:

Plot( vol_ma, "vol_ma " + period , colorYellow );

Just add this line :point_up:t2: after plot ( V, ... like this

Plot( V, "V", vol_col , styleHistogram );

Plot( vol_ma, "vol_ma " + period , colorYellow );

_SECTION_END();



Thank you!!! It works beautifully!

1 Like