TAIndicators

The core difference between these functions and TradingView's standard ones is the ability to specify different moving average types beyond the default. While a standard ta.rsi() is fixed, the rsi() in this library, for example, can be smoothed by an 'SMMA (RMA)', 'WMA', 'VWMA', or others, giving you greater control over your analysis.
█ FEATURES
This library provides enhanced versions of the following popular indicators:
- Moving Average (ma): A versatile MA function that includes optional secondary smoothing and Bollinger Bands.
- RSI (rsi): Calculate RSI with an optional smoothed signal line using various MA types, plus built-in divergence detection.
- MACD (macd): A MACD function where you can define the MA type for both the main calculation and the signal line.
- ATR (atr): An ATR function that allows for different smoothing types.
- VWAP (vwap): A comprehensive anchored VWAP with multiple configurable bands.
- ADX (adx): A standard ADX calculation.
- Cumulative Volume Delta (cvd): Provides CVD data based on a lower timeframe.
- Bollinger Bands (bb): Create Bollinger Bands with a customizable MA type for the basis line.
- Keltner Channels (kc): Keltner Channels with selectable MA types and band styles.
- On-Balance Volume (obv): An OBV indicator with an optional smoothed signal line using various MA types.
- ... and more to come! This library will be actively maintained, with new useful indicator functions added over time.
█ HOW TO USE
To use this library in your scripts, import it using its publishing link. You can then call the functions directly.
For example, to calculate a Weighted Moving Average (WMA) and then smooth it with a Simple Moving Average (SMA):
█ Why Choose This Library?
If you're looking for more control and customization than what's offered by the standard built-in functions, this library is for you. By allowing for a variety of smoothing methods across multiple indicators, it enables a more nuanced and personalized approach to technical analysis. Fine-tune your indicators to better fit your trading style and strategies.
Updated:
Please be aware that these are BREAKING CHANGES. You will need to update any of your existing scripts that use these functions to ensure they continue to work correctly.
1. Standardized Returns for ma(), atr(), and obv()
To make the library more predictable and robust, the ma(), atr(), and obv() functions have been refactored.
Old Behavior: These functions used to return a single value or a list of values depending on the parameters used.
New Behavior: They will always return a complete list (a tuple) of all possible outputs. If an output is not applicable (e.g., you don't request smoothing), its place in the list will now be filled with na.
Action Required: You must update how you call these functions to receive a list.
Example for ma():
- Old Code:
- New Code:
The same logic applies to the atr() and obv() functions. This change ensures a consistent and predictable output every time you call the function.
2. New Pivot Outputs for rsi()
The rsi() function has been enhanced to be even more useful for divergence and price action analysis.
New Feature: In addition to divergence booleans, rsi() now also returns two new booleans at the end of its output list:
- A boolean indicating a pivot low has been found on the RSI.
- A boolean indicating a pivot high has been found on the RSI.
Action Required: Because new values have been added to the output list, you must update your code to account for them.
Example for rsi():
- Old Code:
- New Code:
Please update your scripts accordingly to take advantage of these improvements. These changes make the library more stable and feature-rich for everyone.
As always, thank you for your support, and feel free to ask any questions in the comments below!
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.
Penafian
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.