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

Re:CL_Help with correlation indicator needed



PureBytes Links

Trading Reference Links

Laura:

Both TS 4 and TS2K have a correlation indicator but to use it as you
want, it will need modifing as below. But I do not think you will want
ot correlation RSI with price, if by price you mean the close (or
H,L,O), as the correlation is always +1. This is due to the fact that
(price[0]-price[1]) is added to the previous value of the RSI and
therefore, RSI must move in the same direction as from price[1] to
price[0]). 



Copy out the function, Correlation,  and change as below. Load it in
with only one symbol.Change the function RSI to see other correlations.


Inputs: ind(c), dep(RSI(c, 5)), Length(5);
Variables: Counter1(0), Counter2(0), Counter(0),Correlation1(0);

Counter1 = 0;
Counter2 = 0;

For Counter = 0 To Length - 1 Begin
 If (Ind[Counter] >= Ind[Counter + 1] AND
   Dep[Counter] >= Dep[Counter + 1]) OR 
  (Ind[Counter] < Ind[Counter + 1] AND
   Dep[Counter] < Dep[Counter + 1]) Then
		Counter1 = Counter1 + 1
	Else
		Counter2 = Counter2 + 1;
End;
If Counter1 + Counter2 <> 0 Then
  Correlation1=(Counter1-Counter2)/(Counter1+Counter2)
Else
  Correlation1 = 0;


plot1(Correlation1,"");



Subject:  CL_Help with correlation indicator needed
    Date:  Thu, 29 Jun 2000 19:18:17 CEST
   From:   "Laura ." <laura_lue@xxxxxxxxxxx>
      To:   omega-list@xxxxxxxxxx
      CC:   code-list@xxxxxxxxxxxxx

Hi,

can someone help me to code an correlation indicator? What I want is an
indicator which shows the correlation between price and e.g. RSI. If the
RSI rises 5 days together with the price the indicator should have an 
value of +1 which shows the high correlation. On the other hand of
course a negative correlation is -1.

Is this possible, I failed with coding.
Thanks for your help
Laura