Created
October 4, 2017 06:05
-
-
Save ftkro/63f77f9819a36788a48ac51431858f57 to your computer and use it in GitHub Desktop.
Fibonacci Retracement Function written in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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