Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Handwriting the PHP trader_rsi function

Because of my SD Card is limited, I cannot install proper OS and Server to work with PHP to my Raspberry Pi. Without proper version of the PHP i cannot install the trader extension to use trader_rsi function.

My question is, is there any filepath or something that I can check how this function calculates rsi from the extension files? (I mean the direct code.)

For example I found the code for stats_standart_deviation function on the net. But I couldn't find it for trader_rsi function.

I want to find the function and include it like this:

if (!function_exists('stats_standard_deviation')) {
    /**
     * This user-land implementation follows the implementation quite strictly;
     * it does not attempt to improve the code or algorithm in any way. It will
     * raise a warning if you have fewer than 2 values in your array, just like
     * the extension does (although as an E_USER_WARNING, not E_WARNING).
     * 
     * @param array $a 
     * @param bool $sample [optional] Defaults to false
     * @return float|bool The standard deviation or false on error.
     */
    function stats_standard_deviation(array $a, $sample = false) {
        $n = count($a);
        if ($n === 0) {
            trigger_error("The array has zero elements", E_USER_WARNING);
            return false;
        }
        if ($sample && $n === 1) {
            trigger_error("The array has only 1 element", E_USER_WARNING);
            return false;
        }
        $mean = array_sum($a) / $n;
        $carry = 0.0;
        foreach ($a as $val) {
            $d = ((double) $val) - $mean;
            $carry += $d * $d;
        };
        if ($sample) {
            --$n;
        }
        return sqrt($carry / $n);
    }
}

I have XAMPP in my Desktop and pecl trader extensions installed. Here is the manual of the function: http://php.net/manual/tr/function.trader-rsi.php Thanks in advance.

Comments