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

[amibroker] Re: How to Calculate Correlation Across Entire Array Length?



PureBytes Links

Trading Reference Links

Mike and Bruce,

Thanks very much for your comments.  
They've got me on the right track.

- Progster

P.S. - That's a slick trick with Cum( A - A + 1) to get the length of
the various arrays!


--- In amibroker@xxxxxxxxxxxxxxx, "bruce1r" <brucer@xxx> wrote:
>
> Progster -
> 
> I assume that you posted this because you ran into a problem.  I
> suspect that it is related to an old debate about the "period" parm to
> the correlation function.  When you run into these type of issues, I'd
> suggest using explores and looking for boundary effects.  For example,
> a 10 period correlation needs 11 bars for the first value.  That means
> to get a correlation of full length N, you'd use N-1 for the parm.  I
> interpret it as a lookback, but this is a old AB debate.
> 
> 
> Anyway, here's that example for #1 -
> 
> indexname = "DIG";
> index = Foreign( indexname, "C" );
> 
> Lenc = LastValue( Cum( C - C + 1 ) );
> Leni = LastValue( Cum( index - index + 1) );
> 
> //  Show the boundary effect on 2/16/07
> res1 = Correlation( C, index, 10 );
> 
> //  This gives the correlation over the full length of the shortest
array
> //res1 = Correlation( C, index, Min( Lenc, Leni ) - 1 );
> 
> Filter = 1;
> AddColumn( C, Name( ), 8.5 );
> AddColumn( index, indexname, 8.5 );
> AddColumn( Leni, "LENI", 5.0 );
> AddColumn( res1, "CORRELATION", 8.5 );
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >
> > What about option 1 expressed something like this?
> > 
> > LastValue( Correlation( A, B, LastValue(Cum(1) ) );
> > 
> > Mike
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "progster01" <progster@> wrote:
> > >
> > > Hi.  Can anyone suggest an AFL construction that would provide a
> > > calculation of the correlation of 2 arrays across their entire 
> > length?
> > > 
> > > Considering 2 arrays, A and B, either of these final results
would be
> > > desirable:
> > > 
> > > 1.  a single number, measuring the correlation of A and B over their
> > > entire length
> > > 
> > > 2.  an array C, same length as A and B, where each element of C
> > > measures the correlation between A and B over the length "up to that
> > > point".
> > >
> >
>




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

**** 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/