Library "MomentumIndicators" This is a library of 'Momentum Indicators', also denominated as oscillators. The purpose of this library is to organize momentum indicators in just one place, making it easy to access. In addition, it aims to allow customized versions, not being restricted to just the price value. An example of this use case is the popular Stochastic RSI. # Indicators: 1. Relative Strength Index (RSI): Measures the relative strength of recent price gains to recent price losses of an asset. 2. Rate of Change (ROC): Measures the percentage change in price of an asset over a specified time period. 3. Stochastic Oscillator (Stoch): Compares the current price of an asset to its price range over a specified time period. 4. True Strength Index (TSI): Measures the price change, calculating the ratio of the price change (positive or negative) in relation to the absolute price change. The values of both are smoothed twice to reduce noise, and the final result is normalized in a range between 100 and -100. 5. Stochastic Momentum Index (SMI): Combination of the True Strength Index with a signal line to help identify turning points in the market. 6. Williams Percent Range (Williams %R): Compares the current price of an asset to its highest high and lowest low over a specified time period. 7. Commodity Channel Index (CCI): Measures the relationship between an asset's current price and its moving average. 8. Ultimate Oscillator (UO): Combines three different time periods to help identify possible reversal points. 9. Moving Average Convergence/Divergence (MACD): Shows the difference between short-term and long-term exponential moving averages. 10. Fisher Transform (FT): Normalize prices into a Gaussian normal distribution. 11. Inverse Fisher Transform (IFT): Transform the values of the Fisher Transform into a smaller and more easily interpretable scale is through the application of an inverse transformation to the hyperbolic tangent function. This transformation takes the values of the FT, which range from -infinity to +infinity, to a scale limited between -1 and +1, allowing them to be more easily visualized and compared. 12. Premier Stochastic Oscillator (PSO): Normalizes the standard stochastic oscillator by applying a five-period double exponential smoothing average of the %K value, resulting in a symmetric scale of 1 to -1 # Indicators of indicators: ## Stochastic: 1. Stochastic of RSI (Relative Strengh Index) 2. Stochastic of ROC (Rate of Change) 3. Stochastic of UO (Ultimate Oscillator) 4. Stochastic of TSI (True Strengh Index) 5. Stochastic of Williams R% 6. Stochastic of CCI (Commodity Channel Index). 7. Stochastic of MACD (Moving Average Convergence/Divergence) 8. Stochastic of FT (Fisher Transform) 9. Stochastic of Volume 10. Stochastic of MFI (Money Flow Index) 11. Stochastic of On OBV (Balance Volume) 12. Stochastic of PVI (Positive Volume Index) 13. Stochastic of NVI (Negative Volume Index) 14. Stochastic of PVT (Price-Volume Trend) 15. Stochastic of VO (Volume Oscillator) 16. Stochastic of VROC (Volume Rate of Change) ## Inverse Fisher Transform: 1.Inverse Fisher Transform on RSI (Relative Strengh Index) 2.Inverse Fisher Transform on ROC (Rate of Change) 3.Inverse Fisher Transform on UO (Ultimate Oscillator) 4.Inverse Fisher Transform on Stochastic 5.Inverse Fisher Transform on TSI (True Strength Index) 6.Inverse Fisher Transform on CCI (Commodity Channel Index) 7.Inverse Fisher Transform on Fisher Transform (FT) 8.Inverse Fisher Transform on MACD (Moving Average Convergence/Divergence) 9.Inverse Fisher Transfor on Williams R% (Williams Percent Range) 10.Inverse Fisher Transfor on CMF (Chaikin Money Flow) 11.Inverse Fisher Transform on VO (Volume Oscillator) 12.Inverse Fisher Transform on VROC (Volume Rate of Change) ## Stochastic Momentum Index: 1.Stochastic Momentum Index of RSI (Relative Strength Index) 2.Stochastic Momentum Index of ROC (Rate of Change) 3.Stochastic Momentum Index of VROC (Volume Rate of Change) 4.Stochastic Momentum Index of Williams R% (Williams Percent Range) 5.Stochastic Momentum Index of FT (Fisher Transform) 6.Stochastic Momentum Index of CCI (Commodity Channel Index) 7.Stochastic Momentum Index of UO (Ultimate Oscillator) 8.Stochastic Momentum Index of MACD (Moving Average Convergence/Divergence) 9.Stochastic Momentum Index of Volume 10.Stochastic Momentum Index of MFI (Money Flow Index) 11.Stochastic Momentum Index of CMF (Chaikin Money Flow) 12.Stochastic Momentum Index of On Balance Volume (OBV) 13.Stochastic Momentum Index of Price-Volume Trend (PVT) 14.Stochastic Momentum Index of Volume Oscillator (VO) 15.Stochastic Momentum Index of Positive Volume Index (PVI) 16.Stochastic Momentum Index of Negative Volume Index (NVI) ## Relative Strength Index: 1. RSI for Volume 2. RSI for Moving Average
rsi(source, length) RSI (Relative Strengh Index). Measures the relative strength of recent price gains to recent price losses of an asset. Parameters: source: (float) Source of series (close, high, low, etc.) length: (int) Period of loopback Returns: (float) Series of RSI
roc(source, length) ROC (Rate of Change). Measures the percentage change in price of an asset over a specified time period. Parameters: source: (float) Source of series (close, high, low, etc.) length: (int) Period of loopback Returns: (float) Series of ROC
stoch(kLength, kSmoothing, dSmoothing, maTypeK, maTypeD, almaOffsetKD, almaSigmaKD, lsmaOffSetKD) Stochastic Oscillator. Compares the current price of an asset to its price range over a specified time period. Parameters: kLength kSmoothing: (int) Period for smoothig stochastic dSmoothing: (int) Period for signal (moving average of stochastic) maTypeK: (int) Type of Moving Average for Stochastic Oscillator maTypeD: (int) Type of Moving Average for Stochastic Oscillator Signal almaOffsetKD: (float) Offset for Arnaud Legoux Moving Average for Oscillator and Signal almaSigmaKD: (float) Sigma for Arnaud Legoux Moving Average for Oscillator and Signal lsmaOffSetKD: (int) Offset for Least Squares Moving Average for Oscillator and Signal Returns: [float, float] A tuple of Stochastic Oscillator and Moving Average of Stochastic Oscillator
stoch(source, kLength, kSmoothing, dSmoothing, maTypeK, maTypeD, almaOffsetKD, almaSigmaKD, lsmaOffSetKD) Stochastic Oscillator. Customized source. Compares the current price of an asset to its price range over a specified time period. Parameters: source: (float) Source of series (close, high, low, etc.) kLength: (int) Period of loopback to calculate the stochastic kSmoothing: (int) Period for smoothig stochastic dSmoothing: (int) Period for signal (moving average of stochastic) maTypeK: (int) Type of Moving Average for Stochastic Oscillator maTypeD: (int) Type of Moving Average for Stochastic Oscillator Signal almaOffsetKD: (float) Offset for Arnaud Legoux Moving Average for Stoch and Signal almaSigmaKD: (float) Sigma for Arnaud Legoux Moving Average for Stoch and Signal lsmaOffSetKD: (int) Offset for Least Squares Moving Average for Stoch and Signal Returns: [float, float] A tuple of Stochastic Oscillator and Moving Average of Stochastic Oscillator
tsi(source, shortLength, longLength, maType, almaOffset, almaSigma, lsmaOffSet) TSI (True Strengh Index). Measures the price change, calculating the ratio of the price change (positive or negative) in relation to the absolute price change. The values of both are smoothed twice to reduce noise, and the final result is normalized in a range between 100 and -100. Parameters: source: (float) Source of series (close, high, low, etc.) shortLength: (int) Short length longLength: (int) Long length maType: (int) Type of Moving Average for TSI almaOffset: (float) Offset for Arnaud Legoux Moving Average almaSigma: (float) Sigma for Arnaud Legoux Moving Average lsmaOffSet: (int) Offset for Least Squares Moving Average Returns: (float) TSI
smi(sourceTSI, shortLengthTSI, longLengthTSI, maTypeTSI, almaOffsetTSI, almaSigmaTSI, lsmaOffSetTSI, maTypeSignal, smoothingLengthSignal, almaOffsetSignal, almaSigmaSignal, lsmaOffSetSignal) SMI (Stochastic Momentum Index). A TSI (True Strengh Index) plus a signal line. Parameters: sourceTSI: (float) Source of series for TSI (close, high, low, etc.) shortLengthTSI: (int) Short length for TSI longLengthTSI: (int) Long length for TSI maTypeTSI: (int) Type of Moving Average for Signal of TSI almaOffsetTSI: (float) Offset for Arnaud Legoux Moving Average almaSigmaTSI: (float) Sigma for Arnaud Legoux Moving Average lsmaOffSetTSI: (int) Offset for Least Squares Moving Average maTypeSignal smoothingLengthSignal almaOffsetSignal almaSigmaSignal lsmaOffSetSignal Returns: [float, float, float] A tuple with TSI, signal of TSI and histogram of difference
wpr(source, length) Williams R% (Williams Percent Range). Compares the current price of an asset to its highest high and lowest low over a specified time period. Parameters: source: (float) Source of series (close, high, low, etc.) length: (int) Period of loopback Returns: (float) Series of Williams R%
cci(source, length, maType, almaOffset, almaSigma, lsmaOffSet) CCI (Commodity Channel Index). Measures the relationship between an asset's current price and its moving average. Parameters: source: (float) Source of series (close, high, low, etc.) length: (int) Period of loopback maType: (int) Type of Moving Average almaOffset: (float) Offset for Arnaud Legoux Moving Average almaSigma: (float) Sigma for Arnaud Legoux Moving Average lsmaOffSet: (int) Offset for Least Squares Moving Average Returns: (float) Series of CCI
ultimateOscillator(fastLength, middleLength, slowLength) UO (Ultimate Oscilator). Combines three different time periods to help identify possible reversal points. Parameters: fastLength: (int) Fast period of loopback middleLength: (int) Middle period of loopback slowLength: (int) Slow period of loopback Returns: (float) Series of Ultimate Oscilator
ultimateOscillator(source, fastLength, middleLength, slowLength) UO (Ultimate Oscilator). Customized source. Combines three different time periods to help identify possible reversal points. Parameters: source: (float) Source of series (close, high, low, etc.) fastLength: (int) Fast period of loopback middleLength: (int) Middle period of loopback slowLength: (int) Slow period of loopback Returns: (float) Series of Ultimate Oscilator
macd(source, fastLength, slowLength, signalLength, maTypeFast, maTypeSlow, maTypeMACD, almaOffset, almaSigma, lsmaOffSet) MACD (Moving Average Convergence/Divergence). Shows the difference between short-term and long-term exponential moving averages. Parameters: source: (float) Source of series (close, high, low, etc.) fastLength: (int) Period for fast moving average slowLength: (int) Period for slow moving average signalLength: (int) Signal length maTypeFast: (int) Type of fast moving average maTypeSlow: (int) Type of slow moving average maTypeMACD: (int) Type of MACD moving average almaOffset: (float) Offset for Arnaud Legoux Moving Average almaSigma: (float) Sigma for Arnaud Legoux Moving Average lsmaOffSet: (int) Offset for Least Squares Moving Average Returns: [float, float, float] A tuple with MACD, Signal, and Histgram
fisher(length) Fisher Transform. Normalize prices into a Gaussian normal distribution. Parameters: length Returns: [float, float] A tuple with Fisher Transform and signal
fisher(source, length) Fisher Transform. Customized source. Normalize prices into a Gaussian normal distribution. Parameters: source: (float) Source of series (close, high, low, etc.) length Returns: [float, float] A tuple with Fisher Transform and signal
inverseFisher(source, length, subtrahend, denominator) Inverse Fisher Transform. Transform the values of the Fisher Transform into a smaller and more easily interpretable scale is through the application of an inverse transformation to the hyperbolic tangent function. This transformation takes the values of the FT, which range from -infinity to +infinity, to a scale limited between -1 and +1, allowing them to be more easily visualized and compared. Parameters: source: (float) Source of series (close, high, low, etc.) length: (int) Period for loopback subtrahend: (int) Denominator. Useful in unbounded indicators. For example, in CCI. denominator Returns: (float) Series of Inverse Fisher Transform
premierStoch(length, smoothlen) Premier Stochastic Oscillator (PSO). Normalizes the standard stochastic oscillator by applying a five-period double exponential smoothing average of the %K value, resulting in a symmetric scale of 1 to -1. Parameters: length: (int) Period for loopback smoothlen: (int) Period for smoothing Returns: (float) Series of PSO
premierStoch(source, smoothlen, subtrahend, denominator) Premier Stochastic Oscillator (PSO) of custom source. Normalizes the source by applying a five-period double exponential smoothing average. Parameters: source: (float) Source of series (close, high, low, etc.) smoothlen: (int) Period for smoothing subtrahend: (int) Denominator. Useful in unbounded indicators. For example, in CCI. denominator Returns: (float) Series of PSO
Siguiendo fielmente el espíritu TradingView, el autor ha publicado este código Pine como una biblioteca de código abierto, permitiendo que otros programadores de Pine en nuestra comunidad lo utilicen de nuevo. ¡Olé por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en una publicación se rige por las Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.