Cumulative Volume Delta in AFL

#11
Fixed it on my own -

Code:
_SECTION_BEGIN("Cumulative Volume Delta V.1");

X = High - Close;
Y = High - Open;
Z = Open - Low;
A = Close - Low;

uw= IIf(C>O, X, Y);
lw= IIf(C>O, Z, A);
spread= IIf(High!=Low, High - Low, Null);

bl= (spread - (uw+lw));
puw= (uw/spread);
plw= (lw/spread);
pbl= (bl/spread);

vx= (pbl+(puw+plw)/2*Volume);
vy= ((puw+plw)/2*Volume);

bv= IIf(C>O, vx, vy);
sv= IIf(C<O, vx, vy);

cl= Param("Cumulative Length", 14, 10, 100);
cbv= EMA(bv, cl);
csv= EMA(sv, cl);
cvd= (cbv-csv);

PlotGrid(0, colorBrown, pattern = 9, width = 2, label = True);
cvd_color = IIf(cvd>0, colorGreen, colorRed);
SetBarFillColor(cvd_color);
Plot(cvd, "Cumulative Volme Delta", cvd_color, styleArea);
_SECTION_END();
Thanks for this wonderful code. But I would like to represent this volume just like the price chart with 33EMA, could you please post the updated code. Thanks
 

CougarTrader

Well-Known Member
#12
Thanks for this wonderful code. But I would like to represent this volume just like the price chart with 33EMA, could you please post the updated code. Thanks
That code is not Cumulative Volume Delta! Don't be misled...

For correct Cumulative Volume Delta calc one need to have Tick-By-Tick (TBT) Historical Bid, Ask & LTP. Thanks to NSE's TBT cost, in India retail data vendors throw 1 sec snapshot quotes only.

"REAL" Cumulative Volume Delta (and "REAL" Order Flow) is impossible to plot for an Indian Retail Trader.
 

Similar threads