PureBytes Links
Trading Reference Links
|
On Tue, 5 Jun 2001 at 19:34:55, Steve Wiser <slwiserr@xxxx>
wrote about [amibroker] Correlation Index/RSI - AFL Indicators:
Is there any other method that you can use to share the code in these
indicators? As you see below they are scrambled quite well. I know
they are encoded but why is it necessary to encode them? They are only
text files.
Oh Dear! My apologies - not my original intention as no decision here
to encode. I believe my mailer software has done it automatically.
They were contained in text files using 'Notepad'... and I dragged them
into the Email. UUEncoding is pretty common, though agreed for small
AFL code certainly not necessary.
I did think that the file attach was going to be helpful - just click
and save rather than copy and paste. Still, here's the code again for
those having difficulties:
=====================================================
/* CORRELATION INDEX by Peter Carr 3 June 2001
Indicates Correlation between selected Stock and the Main Index
Also provides an indication of divergences between the data
Replace UKX2 with your own index/stock ticker
Set Scaling to Automatic, Grid Lines to Level 0, Percent and Middle
Adjust periods for sensitivity of response
A correlation of 1.0 (100%) indicates both data are perfectly
syncronised (positive correlation)
A correlation of -1.0 (-100%) indicates data have a perfect but
opposite synchronous relationship (inverse or negative correlation)
A correlation of 0.0 indicates no synchronisation at all */
periods = 50 ;
index = foreign( "UKX2", "close" ) ;
graph0 = 100 * correlation( close, index, periods ) ;
title=name() + " Correlation Index (" + writeval( periods, 1.0 ) + ")"
+ writeval( graph0 ) + "%" ;
=====================================================
/* CORRELATION RSI by Peter Carr 3 June 2001
Indicates Correlation between selected Stock and RSI Value
Also provides an indication of divergences between the data
Set Scaling to Automatic, Grid Lines to Level 0, Percent and Middle
Adjust periods for sensitivity of response
A correlation of 1.0 (100%) indicates both data are perfectly
syncronised (positive correlation)
Correlation < 1.0 (< 100%) indicates decreasing levels of
synchronisation - an increasing divergence */
periods = 14 ;
RSIval = RSI( 14 ) ;
graph0 = 100 * correlation( close, RSIval, periods ) ;
title=name() + " Correlation RSI (" + writeval( periods, 1.0 ) + ")"
+ writeval( graph0 ) + "%" ;
=====================================================
Hope that's OK :-)
Peter
--
======================================================================
Peter Carr
Email: pcarr@xxxx ICQ: 22586379
======================================================================
|