maartenheremans

statistics

Library "statistics"
General statistics library.

erf(x) The "error function" encountered in integrating the normal
distribution (which is a normalized form of the Gaussian function).
  Parameters:
    x: The input series.
  Returns: The Error Function evaluated for each element of x.

erfc(x)
  Parameters:
    x: The input series
  Returns: The Complementary Error Function evaluated for each alement of x.

sumOfReciprocals(src, len) Calculates the sum of the reciprocals of the series.
For each element 'elem' in the series:
sum += 1/elem
Should the element be 0, the reciprocal value of 0 is used instead
of NA.
  Parameters:
    src: The input series.
    len: The length for the sum.
  Returns: The sum of the resciprocals of 'src' for 'len' bars back.

mean(src, len) The mean of the series.
(wrapper around ta.sma).
  Parameters:
    src: The input series.
    len: The length for the mean.
  Returns: The mean of 'src' for 'len' bars back.

average(src, len) The mean of the series.
(wrapper around ta.sma).
  Parameters:
    src: The input series.
    len: The length for the average.
  Returns: The average of 'src' for 'len' bars back.

geometricMean(src, len) The Geometric Mean of the series.
The geometric mean is most important when using data representing
percentages, ratios, or rates of change. It cannot be used for
negative numbers
Since the pure mathematical implementation generates a very large
intermediate result, we performed the calculation in log space.
  Parameters:
    src: The input series.
    len: The length for the geometricMean.
  Returns: The geometric mean of 'src' for 'len' bars back.

harmonicMean(src, len) The Harmonic Mean of the series.
The harmonic mean is most applicable to time changes and, along
with the geometric mean, has been used in economics for price
analysis. It is more difficult to calculate; therefore, it is less
popular than eiter of the other averages.
0 values are ignored in the calculation.
  Parameters:
    src: The input series.
    len: The length for the harmonicMean.
  Returns: The harmonic mean of 'src' for 'len' bars back.

median(src, len) The median of the series.
(a wrapper around ta.median)
  Parameters:
    src: The input series.
    len: The length for the median.
  Returns: The median of 'src' for 'len' bars back.

variance(src, len, biased) The variance of the series.
  Parameters:
    src: The input series.
    len: The length for the variance.
    biased: Wether to use the biased calculation (for a population), or the
unbiased calculation (for a sample set). .
  Returns: The variance of 'src' for 'len' bars back.

stdev(src, len, biased) The standard deviation of the series.
  Parameters:
    src: The input series.
    len: The length for the stdev.
    biased: Wether to use the biased calculation (for a population), or the
unbiased calculation (for a sample set). .
  Returns: The standard deviation of 'src' for 'len' bars back.

skewness(src, len) The skew of the series.
Skewness measures the amount of distortion from a symmetric
distribution, making the curve appear to be short on the left
(lower prices) and extended to the right (higher prices). The
extended side, either left or right is called the tail, and a
longer tail to the right is called positive skewness. Negative
skewness has the tail extending towards the left.
  Parameters:
    src: The input series.
    len: The length for the skewness.
  Returns: The skewness of 'src' for 'len' bars back.

kurtosis(src, len) The kurtosis of the series.
Kurtosis describes the peakedness or flatness of a distribution.
This can be used as an unbiased assessment of whether prices are
trending or moving sideways. Trending prices will ocver a wider
range and thus a flatter distribution (kurtosis < 3; negative
kurtosis). If prices are range-bound, there will be a clustering
around the mean and we have positive kurtosis (kurtosis > 3)
  Parameters:
    src: The input series.
    len: The length for the kurtosis.
  Returns: The kurtosis of 'src' for 'len' bars back.

excessKurtosis(src, len) The normalized kurtosis of the series.
kurtosis > 0 --> positive kurtosis --> trending
kurtosis < 0 --> negative krutosis --> range-bound
  Parameters:
    src: The input series.
    len: The length for the excessKurtosis.
  Returns: The excessKurtosis of 'src' for 'len' bars back.

normDist(src, len, value) Calculates the probability mass for the value according to the
src and length. It calculates the probability for value to be
present in the normal distribution calculated for src and length.
  Parameters:
    src: The input series.
    len: The length for the normDist.
    value: The series of values to calculate the normal distance for
  Returns: The normal distance of 'value' to 'src' for 'len' bars back.

normDistCumulative(src, len, value) Calculates the cumulative probability mass for the value according
to the src and length. It calculates the cumulative probability for
value to be present in the normal distribution calculated for src
and length.
  Parameters:
    src: The input series.
    len: The length for the normDistCumulative.
    value: The series of values to calculate the cumulative normal distance
for
  Returns: The cumulative normal distance of 'value' to 'src' for 'len' bars
back.

zScore(src, len, value) Returns then z-score of objective to the series src.
It returns the number of stdev's the objective is away from the
mean(src, len)
  Parameters:
    src: The input series.
    len: The length for the zScore.
    value: The series of values to calculate the cumulative normal distance
for
  Returns: The z-score of objectiv with respect to src and len.

er(src, len) Calculates the efficiency ratio of the series.
It measures the noise of the series. The lower the number, the
higher the noise.
  Parameters:
    src: The input series.
    len: The length for the efficiency ratio.
  Returns: The efficiency ratio of 'src' for 'len' bars back.

efficiencyRatio(src, len) Calculates the efficiency ratio of the series.
It measures the noise of the series. The lower the number, the
higher the noise.
  Parameters:
    src: The input series.
    len: The length for the efficiency ratio.
  Returns: The efficiency ratio of 'src' for 'len' bars back.

fractalEfficiency(src, len) Calculates the efficiency ratio of the series.
It measures the noise of the series. The lower the number, the
higher the noise.
  Parameters:
    src: The input series.
    len: The length for the efficiency ratio.
  Returns: The efficiency ratio of 'src' for 'len' bars back.

mse(src, len) Calculates the Mean Squared Error of the series.
  Parameters:
    src: The input series.
    len: The length for the mean squared error.
  Returns: The mean squared error of 'src' for 'len' bars back.

meanSquaredError(src, len) Calculates the Mean Squared Error of the series.
  Parameters:
    src: The input series.
    len: The length for the mean squared error.
  Returns: The mean squared error of 'src' for 'len' bars back.

rmse(src, len) Calculates the Root Mean Squared Error of the series.
  Parameters:
    src: The input series.
    len: The length for the root mean squared error.
  Returns: The root mean squared error of 'src' for 'len' bars back.

rootMeanSquaredError(src, len) Calculates the Root Mean Squared Error of the series.
  Parameters:
    src: The input series.
    len: The length for the root mean squared error.
  Returns: The root mean squared error of 'src' for 'len' bars back.

mae(src, len) Calculates the Mean Absolute Error of the series.
  Parameters:
    src: The input series.
    len: The length for the mean absolute error.
  Returns: The mean absolute error of 'src' for 'len' bars back.

meanAbsoluteError(src, len) Calculates the Mean Absolute Error of the series.
  Parameters:
    src: The input series.
    len: The length for the mean absolute error.
  Returns: The mean absolute error of 'src' for 'len' bars back.
Bibliothèque Pine

Dans le véritable esprit de TradingView, l'auteur a publié ce code Pine en tant que bibliothèque open-source afin que d'autres programmeurs Pine de notre communauté puissent le réutiliser. Bravo à l'auteur ! Vous pouvez utiliser cette bibliothèque à titre privé ou dans d'autres publications open-source, mais la réutilisation de ce code dans une publication est régie par notre Règlement.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser cette bibliothèque?

Copiez le texte dans le presse-papiers et collez-le dans votre script.