How to do this with Amibroker?

#1
dear friends

how to calculate average Volume of previous 5 days?
Lets say, we have EOD data upto 26-Feb-2007, then
how to calculate 5 day average volume of previous 5 trading
sessions excluding 26-Feb-2007?

have a nice day
JB
 

a1d

New Member
#2
Hi

if the your data not include 26-Feb-2007 it will excluding it
how we do that?
you can remove this date by deleteing this information from you data
 
#3
dear friends

how to calculate average Volume of previous 5 days?
Lets say, we have EOD data upto 26-Feb-2007, then
how to calculate 5 day average volume of previous 5 trading
sessions excluding 26-Feb-2007?

have a nice day
JB
Sorry man, didn't notice your post.

You need to calculate avg. of "last" five days. So you need to refer "backwards". I think the Ref() will help you out.

The AFL is given below. Let us know if you find any problem with it.

_SECTION_BEGIN("Prev5daysAvg");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
field = ParamField("Field");
period = Param("Period", 5, 1);
prev5daysAvg = MA(Ref(field, -1), period);
Plot(prev5daysAvg,"prev5daysAvg", ParamColor("Colour", colorGreen), styleLine);
_SECTION_END();
 

Similar threads