[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Standard deviation of Intraday average volume



PureBytes Links

Trading Reference Links

Hi Bill,

Thanks for the attempt, however the results don't much Excel (the Standard dev is a little over half of what it should be). Since Etoke is working on the same thing I will add my comments into his thread.

Tip2012

--- In amibroker@xxxxxxxxxxxxxxx, Bill S <wjs45244@xxx> wrote:
>
> I haven't checked the accuracy you can try this:
> Avgvol=0;
> sd = 0;
> if (Interval()<inDaily)
> {
>    n = round(3600*6.75/Interval()); //number of bars in the day
>    d = Param("Lookback days",5,1,30,1); //averaging period
>    barnum = BarsSince(Day()!=Ref(Day(),-1)); //bar number from start of the
> day
>    for (i=0; i<n; i++)
>    {
>        VarSet("vol"+i,IIf(i==barnum,V,0));
>     }
>      for (i=0; i<n; i++)
>     {
>       Avgvol=IIf(barnum==i,Sum(VarGet("vol"+i),n*d)/d,Avgvol);
>       sd = IIf( barnum==i, StDev( VarGet( "vol"+i), n*d), sd);
>     }
>   Plot( Avgvol, "Average Volume:" + d + " days", colorWhite, styleLine );
>   Plot( Avgvol+sd, "1 std dev:", colorBrown, styleLine);
> }
> 
> 
> 
> 
> On Fri, May 1, 2009 at 11:17 AM, gucytribe <angus@xxx> wrote:
> 
> >
> >
> > Hi,
> >
> > I downloaded this code from the Amibroker AFL library which calculates the
> > intraday average volume. I have been trying to calculate the standard
> > deviation of volume for the same time of day, however after messing around
> > with it for quite some time I still haven't managed to code anything that
> > gives the correct answer.
> >
> > Can someone please help?
> >
> > Many thanks.
> >
> > Avgvol=0;
> > if (Interval()<inDaily) {
> > n = round(3600*6.75/Interval()); //number of bars in the day
> > d = Param("Lookback days",5,1,30,1); //averaging period
> > barnum = BarsSince(Day()!=Ref(Day(),-1)); //bar number from start of the
> > day
> > for (i=0; i<n; i++) {
> > VarSet("vol"+i,IIf(i==barnum,V,0));
> > }
> > for (i=0; i<n; i++) {
> > Avgvol=IIf(barnum==i,Sum(VarGet("vol"+i),n*d)/d,Avgvol);
> > }
> >
> > }
> >
> >  
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/