PINE LIBRARY

ArrayMovingAverages

Library "ArrayMovingAverages"

This library adds several moving average methods to arrays, so you can call, eg.:



method emaArray(id, length)
  Calculate Exponential Moving Average (EMA) for Arrays
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    length (int): (int) Length of the EMA
  Returns: (array<float>) Array of EMA values

method ema(id, length)
  Get the last value of the EMA array
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    length (int): (int) Length of the EMA
  Returns: (float) Last EMA value or na if empty

method rmaArray(id, length)
  Calculate Rolling Moving Average (RMA) for Arrays
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    length (int): (int) Length of the RMA
  Returns: (array<float>) Array of RMA values

method rma(id, length)
  Get the last value of the RMA array
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    length (int): (int) Length of the RMA
  Returns: (float) Last RMA value or na if empty

method smaArray(id, windowSize)
  Calculate Simple Moving Average (SMA) for Arrays
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    windowSize (int): (int) Window size for calculation, defaults to array size
  Returns: (array<float>) Array of SMA values

method sma(id, windowSize)
  Get the last value of the SMA array
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    windowSize (int): (int) Window size for calculation, defaults to array size
  Returns: (float) Last SMA value or na if empty

method wmaArray(id, windowSize)
  Calculate Weighted Moving Average (WMA) for Arrays
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    windowSize (int): (int) Window size for calculation, defaults to array size
  Returns: (array<float>) Array of WMA values

method wma(id, windowSize)
  Get the last value of the WMA array
  Namespace types: array<float>
  Parameters:
    id (array<float>): (array<float>) Input array
    windowSize (int): (int) Window size for calculation, defaults to array size
  Returns: (float) Last WMA value or na if empty
moving_averageMoving AveragesPine utilitiesstatistics

Bibliothèque Pine

Dans le plus pur esprit 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 en privé ou dans d'autres publications à code source ouvert, mais la réutilisation de ce code dans une publication est régie par nos Règles.

Clause de non-responsabilité