10 if (isnan(value))
return NAN;
12 self->sum2 += value * value;
14 if (self->count <= self->dof)
return NAN;
15 self->value = (self->sum2 - self->count * mean * mean)
16 / (self->count - self->dof);
26 WU_Var var = malloc(
sizeof(
struct WU_Var_));
27 if (!var)
return NULL;
40 self->value = isnan(var) ? NAN : sqrt(var);
50 WU_StDev stdev = malloc(
sizeof(
struct WU_StDev_));
51 if (!stdev)
return NULL;
#define wu_indicator_delete(indicator)
Delete the indicator and free any resources allocated by it.
#define wu_indicator_update(indicator, value)
Header file for technical indicators.
WU_Mean wu_mean_new(void)
Creates a new WU_Mean indicator.
A global standard deviation calcular.
A glabal variance calculator.
WU_Var wu_var_new(int dof)
Createas a new variance indicator.
static double var_update(WU_Var self, double value)
The variance is compute based on the difference between \sum x^2 - n * mean.
static void stdev_delete(struct WU_StDev_ *self)
static double stdev_update(WU_StDev self, double value)
WU_StDev wu_stdev_new(int dof)
Creates a new standard deviation indicator.
static void var_delete(struct WU_Var_ *self)