Skip to main content

Cumulative Volume Delta for Amibroker (AFL)

Krishnendu over 3 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 1)
  • Tags:
    amibroker, oscillator, AFL, cumulative volume delta

I have coded this “cumulative volume delta” on my own, This is my first code in AFL. I am just testing it on AmiBroker through investing.com data feed. Please let me know if it is working properly. Please fix it as necessary, and mention the applied “FIX” in this post as reply. Thanks for your time. Regards.

Indicator / Formula

Copy & Paste Friendly

Apply as oscillator through "Insert" option.

_SECTION_BEGIN("Cumulative Volume Delta");
upper_wick = IIf(C>O, H-C, H-O); 
lower_wick = IIf(C>O, O-L, C-L);
spread = (H-L);

body_length = (spread - (upper_wick-lower_wick));
percent_upper_wick = (upper_wick/spread);
percent_lower_wick = (lower_wick/spread);
percent_body_length = (body_length/spread);

x= (percent_body_length+(percent_upper_wick+percent_lower_wick)/2*Volume);
y= ((percent_upper_wick+percent_lower_wick)/2*Volume);
 
buying_volume = IIf(C>O, x, y);
selling_volume = IIf(C<O, x, y);

cumulation_length = Param("Cumulative Length", 14, 10, 100);
cumulative_buying_volume= EMA(buying_volume, cumulation_length);
cumulative_selling_volume = EMA(selling_volume, cumulation_length); 
cumulative_volume_delta = cumulative_buying_volume - cumulative_selling_volume;

cvd_color = IIf(cumulative_volume_delta > 0, colorGreen, colorRed);

PlotGrid(0, colorBlue, pattern=9, width=2, label=True);
Plot(cumulative_volume_delta, "Cumulative Volme Delta", color=cvd_color, styleHistogram | styleThick, width=3);
_SECTION_END();

3 comments

2. suresh
over 2 years ago

hi sir,
nice work please add delta value start from day open time it’s good for intra trading

3. suresh
over 2 years ago

is it passible to see each of candle delta value
please make changes in this code

Leave Comment

Please login here to leave a comment.