Right. Sorry, too quick on the draw on my part.
Mike
--- In amibroker@xxxxxxxxxxxxxxx,
"ta" <tagroups@xxx> wrote:
>
> Sorry I meant to say Bar 0 of Chg array is Null. Bars 1 thru 5 have
values,
> so on bar 5 StDev should NOT return null.
>
>
>
>
>
> From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of ta
> Sent: Tuesday, August 18, 2009 2:45 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: RE: [amibroker] Re: StDev question
>
>
>
>
>
> Mike
>
>
>
> Bar 0 of Chg array is zero. Bars 1 thru 5 have values, so on bar 5 StDev
> should NOT return null.
>
>
>
> test.jpg
>
>
>
> From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of Mike
> Sent: Tuesday, August 18, 2009 2:38 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: StDev question
>
>
>
>
>
> I suspect that the problem is that your first element in the Chg array is
> {empty}. AmiBroker is probably waiting for 5 non empty values before
giving
> an answer.
>
> Mike
>
> --- In amibroker@xxxxxxxxxxxxxxx
<mailto:amibroker%40yahoogroups.com> , "ta"
> <tagroups@> wrote:
> >
> > The following is a screen shot of an excel spread sheet that contains
data
> > from the trace statement below. As you can see I am trying to
calculate 5
> > bars std of array "Chg". What I don't understand is that
why StDev returns
> > null on bar index 5. It has 5 data points to calculate the STD. Using
> excel
> > function STDEVP I was able to calculate the std for bar index 5. I
have
> > noticed similar behavior with the Correlation and LinRegSlope
functions.
> > What I am missing? I have gotten around this issue by writing my own
STD
> > function. TIA
> >
> >
> >
> >
> > Bar Index
> >
> > close
> >
> > Chg
> >
> > STD
> >
> > STDEVP
> >
> >
> > 0
> >
> > 4.2813
> >
> > {EMPTY}
> >
> > {EMPTY}
> >
> >
> >
> > 1
> >
> > 4.25
> >
> > -0.731088
> >
> > {EMPTY}
> >
> >
> >
> > 2
> >
> > 4.2813
> >
> > 0.736472
> >
> > {EMPTY}
> >
> >
> >
> > 3
> >
> > 4.4063
> >
> > 2.91967
> >
> > {EMPTY}
> >
> >
> >
> > 4
> >
> > 4.4063
> >
> > 0
> >
> > {EMPTY}
> >
> >
> >
> > 5
> >
> > 4.375
> >
> > -0.710348
> >
> > {EMPTY}
> >
> > 1.35092
> >
> >
> > 6
> >
> > 4.2813
> >
> > -2.14171
> >
> > 1.67506
> >
> > 1.67506
> >
> >
> > 7
> >
> > 4.25
> >
> > -0.731088
> >
> > 1.67705
> >
> > 1.67705
> >
> >
> > 8
> >
> > 4.2813
> >
> > 0.736472
> >
> > 0.953698
> >
> > 0.95370
> >
> >
> > 9
> >
> > 4.3125
> >
> > 0.728749
> >
> > 1.07725
> >
> > 1.07725
> >
> >
> >
> > Chg = ROC( Close,1);
> > STD = StDev(Chg, 5);
> > for( i = 0 ; i < 10; i++ )
> > {
> > _TRACE("i: " + i + " close: " + C[i] + "
Chg: " + Chg[i] + " STD: " +
> > STD[i]);
> > }
> >
>