Cumulative volume plot using SAR indicator

Hi,

I’m trying to plot the cumulative volume for when the close is above/below the pSAR. I’m trying to make it reset whenever a cross occurs.

This isn’t quite right. Would appreciate some tips please.

a = SAR();

aa = C>a;
bb = C<a;

e = ValueWhen(aa,V);
ee = ValueWhen(bb,V);

f = Cum(e);
ff = Cum(ee);

g = IIf(aa,f,Null);
gg = IIf(bb,ff,Null);

Plot(g,"",colorGreen,stylehistogram);
Plot(gg,"",colorred,stylehistogram);

https://www.amibroker.com/guide/afl/sumsince.html

1 Like