No, it is a tradestation indicator

### Correlation Divergence

#72Code: 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 ;
```

### Re: Indicators ...

#73https://forexwikitrading.com/en/wiki-tr ... ng-system/

looking to this's method indicator new mt4 working updating

looking to this's method indicator new mt4 working updating

### Re: Indicators ...

#74Dear Mladen and Mrtools:

Please convert the Zero Balance indicator by Larry Williams to MT4 (please see below).

I don't believe there is an MT4 version out there, because my extensive Google search turned up nothing.

Thank you.

{*******************************************************************

Description : Zero Balance Indicator.

forecast_step is predict step value.

Please see

"The definitive guide ot futures trading"

Larry Williams (japanese: p.297)

Usage: Buy set up is that Zero balance line make

continous lower low by 3 times.

When Price crosses over Zero balance.

Sell set up is that Zero Balance line make

continous high high by 3 times.

When Price crosses under Zero Balance.

Parameter: forecast_step(3)

3: predict 3 step future's point. (default)

2: predict 2 step future's point.

1: predict 1 step future's point.

nakayama@swingwaver.com

********************************************************************}

Input: forecast_step(3);

Vars:

Length(7), { Length for IR Low/High }

IRLowbar(0),IRLowDitectBar(0),IRLow(0),

IRHighBar(0),IRHighDitectBar(0),IRHigh(0);

Vars:

status(1),

status_irlow(1),

status_irhigh(0),

Plotday(0),

previous_day(0);

Vars:

ii(0),ID(0);

Arrays:

IR[8](0),

ZeroBalance[4](0),

ThreeRule[4](0);

setplotcolor(3, red);

{ Definition of IR High/Low }

if BarNumber > Length then begin

condition1 = High > Highest(High,Length)[1];

condition2 = Low < Lowest(Low,Length)[1];

end;

{ Lowestbar(price,10) return bar number of ago that has

most lowest price for 10 bars. This is important }

if condition1 and status = status_irhigh then begin { To find IR Low }

IRLowDitectBar = BarNumber;

IRLowBar = LowestBar(Low, BarNumber-IRHighDitectBar+IRHighBar);

IRLow = Lowest(Low,BarNumber-IRHighDitectBar+IRHighBar);

status = status_irlow;

Plot1[IRLowBar](IRLow,"IR");

end;

{ Highestbar(price,10) return bar number of ago that has

most highest price for 10 bars. This is important }

if condition2 and status = status_irlow then begin { To find IR High }

IRHighDitectBar = BarNumber;

IRHighBar = highestbar(high,barnumber-IRLowDitectBar+IRLowBar);

IRHigh = highest(high,barnumber-IRLowDitectBar+IRLowBar);

status = status_irhigh;

Plot1[IRHighBar](IRHigh,"IR");

end;

if status <> status[1] then begin {for analyising}

For ii = 1 To Length begin { make room for new IR value}

IR[ii] = IR[ii+1];

end;

if status = status_irlow then begin { Collect IR values }

IR[Length + 1] = IRLow;

Plotday = IRLowBar; { Plot Zerobalance day }

end

else begin

IR[Length + 1] = IRHigh;

Plotday = IRHighBar; { Plot Zerobalance day }

end;

if IR[1] <> 0 then begin

{see p.299 and 306 of larry's book.}

ZeroBalance[1] = IR[4] + IR[3] - IR[1]; { 1 forecast. }

ZeroBalance[2] = IR[5] + IR[4] - IR[2]; { 2 forecast. }

ZeroBalance[3] = ZeroBalance[1] + IR[5] - IR[3]; { 3 forecast. }

for ii = 1 to 3 begin { make room for new forecast value}

ThreeRule[ii] = ThreeRule[ii+1];

end;

ThreeRule[4] = ZeroBalance[3];

condition3 = ThreeRule[2] >= ThreeRule[1] AND ThreeRule[3] >= ThreeRule[2] AND ThreeRule[4] >= ThreeRule[3];

condition4 = ThreeRule[2] <= ThreeRule[1] AND ThreeRule[3] <= ThreeRule[2] AND ThreeRule[4] <= ThreeRule[3];

{if ThreeRule[1] <> 0 then begin}

if condition3 or condition4 then begin

{setplotcolor(2,Green);}

Plot2[Plotday](ZeroBalance[3], "ZB");

end;

{end;}

if forecast_step = 1 and ZeroBalance[1] <> 0 then begin { 1 forecast. }

Plot3[Plotday](ZeroBalance[1], "ZB");

end;

if forecast_step = 2 and ZeroBalance[2] <> 0 then begin { 2 forecast. }

Plot3[Plotday](ZeroBalance[2], "ZB");

end;

if forecast_step = 3 and ZeroBalance[3] <> 0 then begin { 3 forecast. }

Plot3[Plotday](ZeroBalance[3], "ZB");

end;

previous_day=Plotday;

end;

end;

if date = LastCalcDate then begin

if IR[1] <> 0 then begin

{see p.299 and 306 of larry's book.}

ZeroBalance[1] = IR[4] + IR[3] - IR[1]; { 1 forecast. }

ZeroBalance[2] = IR[5] + IR[4] - IR[2]; { 2 forecast. }

ZeroBalance[3] = ZeroBalance[1] + IR[5] - IR[3]; { 3 forecast. }

for ii = 1 to 3 begin { make room for new forecast value}

ThreeRule[ii] = ThreeRule[ii+1];

end;

ThreeRule[4] = ZeroBalance[3];

condition3 = ThreeRule[2] >= ThreeRule[1] AND ThreeRule[3] >= ThreeRule[2] AND ThreeRule[4] >= ThreeRule[3];

condition4 = ThreeRule[2] <= ThreeRule[1] AND ThreeRule[3] <= ThreeRule[2] AND ThreeRule[4] <= ThreeRule[3];

{if ThreeRule[1] <> 0 then begin}

if condition3 or condition4 then begin

{setplotcolor(2,Green);}

Plot2(ZeroBalance[3], "ZB");

end;

{end;}

if forecast_step = 1 and ZeroBalance[1] <> 0 then begin { 1 forecast. }

Plot3(ZeroBalance[1], "ZB");

end;

if forecast_step = 2 and ZeroBalance[2] <> 0 then begin { 2 forecast. }

Plot3(ZeroBalance[2], "ZB");

end;

if forecast_step = 3 and ZeroBalance[3] <> 0 then begin { 3 forecast. }

Plot3(ZeroBalance[3], "ZB");

end;

previous_day=Plotday;

end;

end;

Please convert the Zero Balance indicator by Larry Williams to MT4 (please see below).

I don't believe there is an MT4 version out there, because my extensive Google search turned up nothing.

Thank you.

{*******************************************************************

Description : Zero Balance Indicator.

forecast_step is predict step value.

Please see

"The definitive guide ot futures trading"

Larry Williams (japanese: p.297)

Usage: Buy set up is that Zero balance line make

continous lower low by 3 times.

When Price crosses over Zero balance.

Sell set up is that Zero Balance line make

continous high high by 3 times.

When Price crosses under Zero Balance.

Parameter: forecast_step(3)

3: predict 3 step future's point. (default)

2: predict 2 step future's point.

1: predict 1 step future's point.

nakayama@swingwaver.com

********************************************************************}

Input: forecast_step(3);

Vars:

Length(7), { Length for IR Low/High }

IRLowbar(0),IRLowDitectBar(0),IRLow(0),

IRHighBar(0),IRHighDitectBar(0),IRHigh(0);

Vars:

status(1),

status_irlow(1),

status_irhigh(0),

Plotday(0),

previous_day(0);

Vars:

ii(0),ID(0);

Arrays:

IR[8](0),

ZeroBalance[4](0),

ThreeRule[4](0);

setplotcolor(3, red);

{ Definition of IR High/Low }

if BarNumber > Length then begin

condition1 = High > Highest(High,Length)[1];

condition2 = Low < Lowest(Low,Length)[1];

end;

{ Lowestbar(price,10) return bar number of ago that has

most lowest price for 10 bars. This is important }

if condition1 and status = status_irhigh then begin { To find IR Low }

IRLowDitectBar = BarNumber;

IRLowBar = LowestBar(Low, BarNumber-IRHighDitectBar+IRHighBar);

IRLow = Lowest(Low,BarNumber-IRHighDitectBar+IRHighBar);

status = status_irlow;

Plot1[IRLowBar](IRLow,"IR");

end;

{ Highestbar(price,10) return bar number of ago that has

most highest price for 10 bars. This is important }

if condition2 and status = status_irlow then begin { To find IR High }

IRHighDitectBar = BarNumber;

IRHighBar = highestbar(high,barnumber-IRLowDitectBar+IRLowBar);

IRHigh = highest(high,barnumber-IRLowDitectBar+IRLowBar);

status = status_irhigh;

Plot1[IRHighBar](IRHigh,"IR");

end;

if status <> status[1] then begin {for analyising}

For ii = 1 To Length begin { make room for new IR value}

IR[ii] = IR[ii+1];

end;

if status = status_irlow then begin { Collect IR values }

IR[Length + 1] = IRLow;

Plotday = IRLowBar; { Plot Zerobalance day }

end

else begin

IR[Length + 1] = IRHigh;

Plotday = IRHighBar; { Plot Zerobalance day }

end;

if IR[1] <> 0 then begin

{see p.299 and 306 of larry's book.}

ZeroBalance[1] = IR[4] + IR[3] - IR[1]; { 1 forecast. }

ZeroBalance[2] = IR[5] + IR[4] - IR[2]; { 2 forecast. }

ZeroBalance[3] = ZeroBalance[1] + IR[5] - IR[3]; { 3 forecast. }

for ii = 1 to 3 begin { make room for new forecast value}

ThreeRule[ii] = ThreeRule[ii+1];

end;

ThreeRule[4] = ZeroBalance[3];

condition3 = ThreeRule[2] >= ThreeRule[1] AND ThreeRule[3] >= ThreeRule[2] AND ThreeRule[4] >= ThreeRule[3];

condition4 = ThreeRule[2] <= ThreeRule[1] AND ThreeRule[3] <= ThreeRule[2] AND ThreeRule[4] <= ThreeRule[3];

{if ThreeRule[1] <> 0 then begin}

if condition3 or condition4 then begin

{setplotcolor(2,Green);}

Plot2[Plotday](ZeroBalance[3], "ZB");

end;

{end;}

if forecast_step = 1 and ZeroBalance[1] <> 0 then begin { 1 forecast. }

Plot3[Plotday](ZeroBalance[1], "ZB");

end;

if forecast_step = 2 and ZeroBalance[2] <> 0 then begin { 2 forecast. }

Plot3[Plotday](ZeroBalance[2], "ZB");

end;

if forecast_step = 3 and ZeroBalance[3] <> 0 then begin { 3 forecast. }

Plot3[Plotday](ZeroBalance[3], "ZB");

end;

previous_day=Plotday;

end;

end;

if date = LastCalcDate then begin

if IR[1] <> 0 then begin

{see p.299 and 306 of larry's book.}

ZeroBalance[1] = IR[4] + IR[3] - IR[1]; { 1 forecast. }

ZeroBalance[2] = IR[5] + IR[4] - IR[2]; { 2 forecast. }

ZeroBalance[3] = ZeroBalance[1] + IR[5] - IR[3]; { 3 forecast. }

for ii = 1 to 3 begin { make room for new forecast value}

ThreeRule[ii] = ThreeRule[ii+1];

end;

ThreeRule[4] = ZeroBalance[3];

condition3 = ThreeRule[2] >= ThreeRule[1] AND ThreeRule[3] >= ThreeRule[2] AND ThreeRule[4] >= ThreeRule[3];

condition4 = ThreeRule[2] <= ThreeRule[1] AND ThreeRule[3] <= ThreeRule[2] AND ThreeRule[4] <= ThreeRule[3];

{if ThreeRule[1] <> 0 then begin}

if condition3 or condition4 then begin

{setplotcolor(2,Green);}

Plot2(ZeroBalance[3], "ZB");

end;

{end;}

if forecast_step = 1 and ZeroBalance[1] <> 0 then begin { 1 forecast. }

Plot3(ZeroBalance[1], "ZB");

end;

if forecast_step = 2 and ZeroBalance[2] <> 0 then begin { 2 forecast. }

Plot3(ZeroBalance[2], "ZB");

end;

if forecast_step = 3 and ZeroBalance[3] <> 0 then begin { 3 forecast. }

Plot3(ZeroBalance[3], "ZB");

end;

previous_day=Plotday;

end;

end;