Skip to content

Instantly share code, notes, and snippets.

@ftkro
Created October 4, 2017 06:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ftkro/63f77f9819a36788a48ac51431858f57 to your computer and use it in GitHub Desktop.
Save ftkro/63f77f9819a36788a48ac51431858f57 to your computer and use it in GitHub Desktop.
Fibonacci Retracement Function written in PHP
<?php
//If $Reverse option was set true, return value will be use reversed Fibonacci retracement.
//Return value is always desc.
function FibRet($High,$Low,$Reverse=false) {
$FibNum=array(
0,
0.236,
0.382,
0.5,
0.618,
0.786,
1
);
if($Reverse==true) {
rsort($FibNum);
list($High, $Low) = array($Low, $High);
}
$Store=null;
foreach ($FibNum as $item) {
$Store[] = $High-($High-$Low)*$item;
}
return $Store;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment