trader_ema

(PECL trader >= 0.2.0)

trader_emaMoyenne mobile exponentielle

Description

array trader_ema ( array $real [, integer $timePeriod ] )

Liste de paramètres

real

Tableau de valeurs réelles.

timePeriod

Nombre de période. Intervalle valide : 2 à 100000.

Valeurs de retour

Retourne un tableau contenant les données calculées, ou FALSE si une erreur survient.

add a note add a note

User Contributed Notes 2 notes

up
0
abovesense at hotmail dot com
1 year ago
Hello there,
Is someone have tried the function and can tell what is the return size digits after the decimal point, meaning what is the precision of the returned  answer ?
Best,
laye
up
-2
manoj dot monu23 at gmail dot com
2 years ago
the trader_ema() function does'nt work correctly , it calculate just average of last period entries. Follow the following code for trader_ema:
function EMACalculator($limit,$array)
{
    $EMA_previous_day = $array[0];
    //print_r($array);
    $multiplier1 = (2/$limit+1);
    $EMA[]=array();
    $EMA = $array[0];
    $Close= $array[1];
   
    while($limit)
{   
    //echo"EMA is $EMA\n";
    $EMA = ($Close - $EMA_previous_day) * $multiplier1 + $EMA_previous_day;
    $EMA_previous_day= $EMA;
   
    $limit--;
}
return $EMA;
}
where $limit accept the period of ema  and $array : accept array of data for ema calculation.
To Top