Fractals 0

Posted on 3, March 2014

in Category SID


Description for Fractals SID 135

First introduced to Forex by Bill Williams.

Fractals/sid The logic for this technical analysis indicator:

my $upFractal = If((Ref(High,-2) > Ref(High, -4)) && (Ref(High,-2) > Ref(High, -3)) && (Ref(High,-2) > Ref(High, -1)) && (Ref(High,-2) > High),Ref(High,-2),0);
my $downFractal = If((Ref(Low,-2) <= Ref(Low, -4)) && (Ref(Low,-2) <=  Ref(Low, -3)) && (Ref(Low,-2) <=  Ref(Low, -1)) && (Ref(Low,-2) <=  Low), Ref(Low,-2),0);

my $upFractal2 = $upFractal;
my $downFractal2 = $downFractal;

my $prevUpValue;
my $prevDownValue; 

#loop through the column handing zero cases.
for my $i (1..NumberOfBars-1) {
  my $currUpValue = Value($upFractal,$i);
  my $currDownValue = Value($downFractal,$i);

  if($currUpValue==0){
     SetValue($upFractal2,$i,$prevUpValue);
  }else{
    $prevUpValue = $currUpValue;
  }

  if($currDownValue==0){
   SetValue($downFractal2,$i,$prevDownValue);
  }else{
	$prevDownValue = $currDownValue;
  }
}

#Name the columns
SetColumnName($upFractal,"FractalUp");
SetColumnName($downFractal,"FractalDown");

return($upFractal,$downFractal);

0 Comments

Leave a Message