Cumulative Volume Delta in AFL

#1
I am trying to code ""Cumulative Volume Delta" in AFL. My code is as follows -

Code:
_SECTION_BEGIN("Cumulative Volume Delta");
uw= IIf(C>O, H-C, H-O);
lw= IIf(C>O, O-L, C-L);
spread= (H-L);

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

x= (pbl+(puw+plw)/2*Volume);
y= ((puw+plw)/2*Volume);
 
bv= IIf(C>O, x, y);
sv= IIf(C<O, x, y);

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

cvd_color= IIf(cvd>0, colorGreen, colorRed);
Plot(cvd, "Cumulative Volme Delta", cvd_color, styleHistogram | styleThick, width=3);
_SECTION_END();
It is not giving desired result. Can anyone here please fix this? Thanks for your time. Regards.
 
#2
I am trying to code ""Cumulative Volume Delta" in AFL. My code is as follows -

Code:
_SECTION_BEGIN("Cumulative Volume Delta");
uw= IIf(C>O, H-C, H-O);
lw= IIf(C>O, O-L, C-L);
spread= (H-L);

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

x= (pbl+(puw+plw)/2*Volume);
y= ((puw+plw)/2*Volume);

bv= IIf(C>O, x, y);
sv= IIf(C<O, x, y);

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

cvd_color= IIf(cvd>0, colorGreen, colorRed);
Plot(cvd, "Cumulative Volme Delta", cvd_color, styleHistogram | styleThick, width=3);
_SECTION_END();
It is not giving desired result. Can anyone here please fix this? Thanks for your time. Regards.
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();
 
#6
I found the logic on tradingview "Cumulative Volume Delta" script.

I am also in need to know the function necessary to shift histogram base from 0 to 50 in AFL. If you know that, please share. Regards.
 

mohan.sic

Well-Known Member
#7
I found the logic on tradingview "Cumulative Volume Delta" script.

I am also in need to know the function necessary to shift histogram base from 0 to 50 in AFL. If you know that, please share. Regards.


1. Thats useless you dont have that tick data available to amibroker. So no point in afl.
2. As a next logical step people go for 1 sec data. But I think even that is useless, because when you compare 1 sec data between providers they vary and now please don't think that one provider is more accurate than other.

So please don't waste your time in this creating afl's unless your time has no value.
 
#10
Cumulative Volume Delta Histogram Crossover and Cross down the median zero line. I do enter long and short trade according to that on multi-timeframe charts. I use it in confluence with other indicators as required. I keep on riding the trend with trailing stop loss manually. There are three exit methods I use trailing stop loss hit, indicator based, and reward target based.
 

Similar threads