|
inputs:
IndepData( Close of data1 ),
DepData1( Close of data2 ),
DepData2( Close of data3 ),
DepData3( Close of data4 ),
DepData4( Close of data5 ),
Length( 26 ),
Length2(3),
PosCorrAlert( .7 ),
NegCorrAlert( -.7 ) ;
variables:
CorrelVal( 0 ),
CV1(0), CV2(0), CV3(0), CV4(0)
;
//CorrelVal = ( Correlation( IndepData, DepData, Length ) +
CV1= DepData1;
CV2= DepData2;
CV3= DepData3;
CV4= DepData4;
CorrelVal = ( Correlation( CV2, CV1, Length ) +
Correlation( CV3, CV2, Length ) +
Correlation( CV4, CV1, Length ) +
Correlation( CV4, CV2, Length ) +
Correlation( CV4, CV3, Length ) +
Correlation( CV1, CV3, Length ) ) / 6
;
//Plot1( jtHMA(CorrelVal, 6) , "Correl" ) ;
Plot1 (CorrelVal, "Correl");
//Plot2( PosCorrAlert, "PosCorrAlert" ) ;
//Plot3( NegCorrAlert, "NegCorrAlert" ) ;
{ Alert criteria }
if CorrelVal crosses over PosCorrAlert then
Alert( "Positive correlation alert" )
else if CorrelVal crosses under NegCorrAlert then
Alert( "Negative correlation alert" ) ; |
|