PINE LIBRARY

LibMvAv

63
Library "LibMvAv"
This library provides a unified interface for calculating a
wide variety of moving averages. It is designed to simplify
indicator development by consolidating numerous MA calculations
into a single function and integrating the weighting
capabilities from the `LibWght` library.

Key Features:

1. **All-in-One MA Function:** The core of the library is the
`ma()` function. Users can select the desired calculation
method via the `MAType` enum, which helps create
cleaner and more maintainable code compared to using
many different `ta.*` or custom functions.

2. **Comprehensive Selection of MA Types:** It provides a
selection of 12 different moving averages, covering
common Pine Script built-ins and their weighted counterparts:
- **Standard MAs:** SMA, EMA, WMA, RMA (Wilder's), HMA (Hull), and
LSMA (Least Squares / Linear Regression).
- **Weighted MAs:** Weight-enhanced versions of the above
(WSMA, WEMA, WWMA, WRMA, WHMA, WLSMA).

3. **Integrated Weighting:** The library provides weighted versions
for each of its standard MA types (e.g., `wsma` alongside `sma`).
By acting as a dispatcher, the `ma()` function allows these
weighted calculations to be called using the optional
`weight` parameter, which are then processed by the `LibWght`
library.

4. **Simple API:** The library internally handles the logic of
choosing the correct function based on the selected `MAType`.
The user only needs to provide the source, length, and
optional weight, simplifying the development process.

---

**DISCLAIMER**

This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.

The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.

As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.

ma(maType, source, length, weight)
  Returns the requested moving average.
  Parameters:
    maType (simple MAType): simple MAType Desired type (see enum above).
    source (float): series float Data series to smooth.
    length (simple int): simple int Look-back / period length.
    weight (float): series float Weight series (default = na)
  Returns: series float Moving-average value.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。