Re: Re:

#71
sal wrote:
Sun Jun 25, 2017 5:09 pm
mladen wrote:
Mon Mar 13, 2017 11:32 pm
One "classic" indicator : super trend for tradestation
hi malden/mntiwana
i am unable to load in the chart. is this mt4 indicator!!
No, it is a tradestation indicator

Correlation Divergence

#72

Code: Select all

Indicator: Correlation Divergence
// Correlation Divergence
// Markos Katsanos
// TASC JUL 2017

inputs:
	SEC2( Close of Data2 ),// FXY
	SEC3( Close of Data3 ),//SPY
	D1( 3 ), //ROC DAYS
	DIVDAYS( 50 ),// REGRESSION DAYS
	IMDAYS( 50 ),// DIVERGENCE MOMENTUM DAYS
	CR3CR( .8 ) ; //CORRELATION WITH SEC3
	
variables:
	IM2(0),
	DIV2(0),RS1(0),RS2(0),
	b2(0),PRED2(0),a2(0),
	RS3(0),CR2(0),CR3(0);

//REGRESSION
RS1 = ( Close / Close[D1] - 1 ) * 100 ;
RS2 = ( SEC2 / SEC2[D1] - 1 ) * 100 ;
RS3 = ( SEC3 / SEC3[D1] - 1 ) * 100 ;
CR2 = CorrelationMK( RS1, RS2, DIVDAYS ) ;
CR3 = CorrelationMK( RS1, RS3, DIVDAYS ) ;
b2 = CR2 * StandardDev( RS1, DIVDAYS, 1 ) 
	/ ( StandardDev( RS2, DIVDAYS, 1 ) + .001 ) ;
a2 = Average( RS1, DIVDAYS ) 
	- b2 * Average( RS2, DIVDAYS ) ;
PRED2 = b2 * RS2 + a2 ;
DIV2 = PRED2 - RS1 ;

IM2 = ( Average( DIV2 - 
	Lowest( DIV2, IMDAYS ), 2 ) * 100 ) /
	( Average( Highest( DIV2, IMDAYS ) - 
	Lowest( DIV2, IMDAYS ), 2 ) + .01 ) ;

Plot1( IM2, "RegDiv" ) ;
Plot2( 75, "Upper" ) ;
Plot3( 25, "Lower" ) ;


Function: Correlation MK
{ CORRELATIONMK : Pearson's 
Correlation Function
Copyright 2009, 
Markos Katsanos. 
All rights reserved.
For more information see 
Intermarket Trading Strategies, Wiley,
2009 }

Inputs:
	SEC1( NumericSeries ),
	SEC2( NumericSeries ),
	D1( NumericSimple ); // days for correlation

Variables:
	D2(20),Q1(0),Q2(0),
	Q3(0),Q2Q3(0),R(0);
if CurrentBar >= D1 then 
	begin
	Q1 = Summation((SEC1*(SEC2)),D1)
		-(Summation(SEC1,D1)
		* Summation(SEC2,D1)/D1);

	Q2 = Summation(((SEC2)*(SEC2)),D1) 
		- (Summation(SEC2,D1)
		* Summation(SEC2,D1)/D1);

	Q3 = Summation((SEC1*SEC1),D1) 
		- (Summation(SEC1,D1)
		* Summation(SEC1,D1)/D1);

	if Q2*Q3 > 0 then 
		Q2Q3=SquareRoot(Q2*Q3);
	if Q2Q3 <> 0 then 
		begin
		R=Q1/Q2Q3;
		if R <= 1 and  R >= -1 then
		CorrelationMK = R ;
		end ;
	end ;
	

Who is online

Users browsing this forum: No registered users and 1 guest