PINE LIBRARY
Updated

TechnicalAnalysis

54
█ DCAUT TechnicalAnalysis Library

📊 OVERVIEW

DCAUT TechnicalAnalysis is a professional-grade Pine Script technical analysis library designed for traders and quantitative analysts who demand excellence. This library brings together 25+ advanced moving averages and smoothing filters, from classic SMA/EMA to cutting-edge Kalman Filters and adaptive algorithms, all meticulously implemented based on academic research and industry best practices.

🎯 Core Features
  • Academic Precision - All algorithms strictly follow original papers and formulas
  • Performance Optimized - Pre-calculated constants and optimized algorithms ensure fast response
  • Professional Standards - Unified interface design following TradingView best practices
  • Continuous Innovation - Constantly integrating latest technical analysis research


🎯 CONCEPTS

Why do we need this technical analysis library?
While TradingView has abundant technical indicator code, there are significant issues:

Inconsistent Code Quality
  • Many public indicators lack optimization and perform poorly
  • Algorithm implementations deviate from academic standards
  • Code structure is messy, difficult to maintain and extend
  • Lacks unified interface design and naming conventions


Low Development Efficiency
  • Need to rewrite basic indicator functions every time
  • Debugging and testing consume excessive time
  • High code duplication, prone to introducing errors
  • Lack of professional-grade algorithm implementation references


Our Solution
  • Standardized Implementation: Strictly follows academic papers and original formulas
  • Performance Optimization: Pre-calculated constants reduce redundant computations
  • Unified Interface: Consistent function signatures and naming conventions
  • Plug and Play: One-line import, direct usage, dramatically improves development efficiency
  • Continuous Maintenance: Professional team maintains code quality and accuracy


🚀 USING THIS LIBRARY

Import Library
Pine Script®
//@version=6 import DCAUT/TechnicalAnalysis/1 as dta indicator("Advanced Technical Analysis", overlay=true)


Basic Usage Example
Pine Script®
// Classic moving average combination ema20 = dta.ema(close, 20) hma20 = dta.hma(close, 20) plot(ema20, "EMA20", color.red, 2) plot(hma20, "HMA20", color.green, 2)


Advanced Trading System
Pine Script®
// Adaptive moving average system kama = dta.kama(close, 20, 2, 30) hma = dta.hma(close, 20) // Trend confirmation and entry signals bullTrend = kama > kama[1] and hma > hma[1] bearTrend = kama < kama[1] and hma < hma[1] longSignal = ta.crossover(close, kama) and bullTrend shortSignal = ta.crossunder(close, kama) and bearTrend plot(kama, "KAMA", color.blue, 3) plot(hma, "HMA", color.orange, 2) plotshape(longSignal, "Buy", shape.triangleup, location.belowbar, color.green) plotshape(shortSignal, "Sell", shape.triangledown, location.abovebar, color.red)


📋 FUNCTIONS REFERENCE

sma(source, length)
Calculates the Simple Moving Average of a given data series.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Simple Moving Average value.

ema(source, length)
Calculates the Exponential Moving Average of a given data series.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Exponential Moving Average value.

wma(source, length)
Calculates the Weighted Moving Average of a given data series.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Weighted Moving Average value.

rma(source, length)
Calculates the Rolling Moving Average (SMMA) of a given data series.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Rolling Moving Average value.

ewma(source, alpha)
Calculates the Exponentially Weighted Moving Average with dynamic alpha parameter.

Parameters:
  source (series float): Series of values to process.
  alpha (series float): The smoothing parameter of the filter.

Returns: (float) The exponentially weighted moving average value.

dema(source, length)
Calculates the Double Exponential Moving Average (DEMA) of a given data series.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Double Exponential Moving Average value.

tema(source, length)
Calculates the Triple Exponential Moving Average (TEMA) of a given data series.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Triple Exponential Moving Average value.

zlema(source, length)
Calculates the Zero-Lag Exponential Moving Average (ZLEMA) of a given data series. This indicator attempts to eliminate the lag inherent in all moving averages.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Zero-Lag Exponential Moving Average value.

hma(source, length)
Calculates the Hull Moving Average (HMA) of a given data series. HMA reduces lag and improves smoothing by using weighted averages.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Hull Moving Average value.

vwma(source, volumeSource, length)
Calculates the Volume Weighted Moving Average (VWMA) of a given data series. VWMA gives more weight to periods with higher volume.

Parameters:
  source (series float): Series of values to process.
  volumeSource (series float): Volume series to be used for weighting.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Volume Weighted Moving Average value.

tma(source, length)
Calculates the Triangular Moving Average (TMA) of a given data series. TMA is a double-smoothed simple moving average that reduces noise.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Triangular Moving Average value.

frama(source, length)
Calculates the Fractal Adaptive Moving Average (FRAMA) of a given data series. FRAMA adapts its smoothing factor based on fractal geometry to reduce lag.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: (float) The calculated Fractal Adaptive Moving Average value.

kama(source, length, fastLength, slowLength)
Calculates Kaufman's Adaptive Moving Average (KAMA) of a given data series. KAMA adjusts its smoothing based on market efficiency ratio.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for efficiency calculation.
  fastLength (simple int): Fast EMA length. Optional, default is 2.
  slowLength (simple int): Slow EMA length. Optional, default is 30.

Returns: (float) The calculated Kaufman's Adaptive Moving Average value.

ama(source, length, fastLength, slowLength)
Calculates the Adaptive Moving Average (AMA) of a given data series. AMA adjusts its smoothing based on price range and volatility.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for adaptation calculation.
  fastLength (simple int): Fast smoothing length. Optional, default is 2.
  slowLength (simple int): Slow smoothing length. Optional, default is 30.

Returns: (float) The calculated Adaptive Moving Average value.

vidya(source, length, cmoLength)
Calculates the Variable Index Dynamic Average (VIDYA) of a given data series. VIDYA adapts its smoothing factor based on market volatility using CMO.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Period for EMA calculation.
  cmoLength (simple int): Period for CMO volatility calculation. Optional, default is 9.

Returns: (float) The calculated Variable Index Dynamic Average value.

mcginleyDynamic(source, length)
Calculates the McGinley Dynamic of a given data series. McGinley Dynamic is an adaptive moving average that adjusts to market speed changes.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for dynamic calculation.

Returns: (float) The calculated McGinley Dynamic value.

t3(source, length, volumeFactor)
Calculates the Tilson Moving Average (T3) of a given data series. T3 is a triple-smoothed exponential moving average with improved lag characteristics.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.
  volumeFactor (simple float): Volume factor affecting responsiveness. Optional, default is 0.7.

Returns: (float) The calculated Tilson Moving Average value.

ultimateSmoother(source, length)
Calculates the Ultimate Smoother of a given data series. Uses advanced filtering techniques to reduce noise while maintaining responsiveness.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for smoothing calculation.

Returns: (float) The calculated Ultimate Smoother value.

kalmanFilter(source, processNoise, measurementNoise)
Calculates the Kalman Filter of a given data series. Optimal estimation algorithm that estimates true value from noisy observations.

Parameters:
  source (series float): Series of values to process.
  processNoise (simple float): Process noise variance (Q). Controls adaptation speed. Optional, default is 0.05.
  measurementNoise (simple float): Measurement noise variance (R). Controls smoothing. Optional, default is 1.0.

Returns: (float) The calculated Kalman Filter value.

mama(source, fastLimit, slowLimit)
Calculates the Mesa Adaptive Moving Average (MAMA) of a given data series. MAMA uses Hilbert Transform Discriminator to adapt to market cycles dynamically.

Parameters:
  source (series float): Series of values to process.
  fastLimit (simple float): Maximum alpha (responsiveness). Optional, default is 0.5.
  slowLimit (simple float): Minimum alpha (smoothing). Optional, default is 0.05.

Returns: (float) The calculated Mesa Adaptive Moving Average value.

fama(source, fastLimit, slowLimit)
Calculates the Following Adaptive Moving Average (FAMA) of a given data series. FAMA follows MAMA with reduced responsiveness for crossover signals.

Parameters:
  source (series float): Series of values to process.
  fastLimit (simple float): Maximum alpha (responsiveness). Optional, default is 0.5.
  slowLimit (simple float): Minimum alpha (smoothing). Optional, default is 0.05.

Returns: (float) The calculated Following Adaptive Moving Average value.

mamaFama(source, fastLimit, slowLimit)
Calculates Mesa Adaptive Moving Average (MAMA) and Following Adaptive Moving Average (FAMA).

Parameters:
  source (series float): Series of values to process.
  fastLimit (simple float): Maximum alpha (responsiveness). Optional, default is 0.5.
  slowLimit (simple float): Minimum alpha (smoothing). Optional, default is 0.05.

Returns: ([float, float]) Tuple containing [MAMA, FAMA] values.

alma(source, length, offset, sigma)
Calculates the Arnaud Legoux Moving Average (ALMA) of a given data series. ALMA is a Gaussian filter-based moving average that balances responsiveness and smoothness.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.
  offset (simple float): Phase offset parameter (0-1). Higher values increase responsiveness. Optional, default is 0.85.
  sigma (simple float): Standard deviation parameter affecting filter width. Optional, default is 6.0.

Returns: (float) The calculated Arnaud Legoux Moving Average value.

superSmoother(source, length)
Calculates the Super Smoother of a given data series. SuperSmoother is a second-order Butterworth filter from aerospace technology.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for filter calculation.

Returns: (float) The calculated Super Smoother value.

laguerreFilter(source, length, gamma)
Calculates the Laguerre Filter of a given data series. Laguerre Filter uses 6-pole feedback with UltimateSmoother preprocessing.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Length for UltimateSmoother preprocessing.
  gamma (simple float): Feedback coefficient (0-1). Lower values reduce lag. Optional, default is 0.5.

Returns: (float) The calculated Laguerre Filter value.

lsma(source, length, offset)
Calculates the Least Squares Moving Average (LSMA) of a given data series. LSMA uses linear regression to predict trend with reduced lag.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for linear regression calculation.
  offset (simple int): Offset for the regression line. Optional, default is 0.

Returns: (float) The calculated Least Squares Moving Average value.

rangeFilter(source, length, multiplier)
Calculates the Range Filter of a given data series. Range Filter reduces noise by filtering price movements within a dynamic range.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for average range calculation.
  multiplier (simple float): Multiplier for smooth range. Higher values increase filtering. Optional, default is 2.618.

Returns: ([float, int, float, float]) Tuple containing filtered value, trend direction, upper band, and lower band.

qqe(source, rsiLength, rsiSmooth, qqeFactor)
Calculates the Quantitative Qualitative Estimation (QQE) of a given data series. QQE is an improved RSI that reduces noise and provides smoother signals.

Parameters:
  source (series float): Series of values to process.
  rsiLength (simple int): Number of bars for RSI calculation. Optional, default is 14.
  rsiSmooth (simple int): Number of bars for smoothing RSI. Optional, default is 5.
  qqeFactor (simple float): QQE factor for volatility band width. Optional, default is 4.236.

Returns: ([float, float]) Tuple containing smoothed RSI and QQE trend line.

sslChannel(source, length)
Calculates the Semaphore Signal Level (SSL) Channel of a given data series. SSL Channel provides clear trend signals using moving averages of high and low prices.

Parameters:
  source (series float): Series of values to process.
  length (simple int): Number of bars for moving average calculation.

Returns: ([float, float]) Tuple containing SSL Up and SSL Down lines.

📚 RELEASE NOTES

v1.0 (2025.09.22)
  • 25+ professional technical analysis functions
  • Complete adaptive moving average series
  • Advanced signal processing filters
  • Performance optimization and constant pre-calculation
  • Unified function interface design


📄 License: MIT License
👨‍💻 Developer: DCAUT Team
Release Notes
v2.0 (2025.09.23)
  • ✅ Added universal moving average interface ma()
  • ✅ Added customizable MA type ATR function
  • ✅ Added customizable MA type MACD function
  • ✅ Support for flexible combinations of 21 moving average algorithms
  • ✅ Enhanced volatility and trend analysis tools
Release Notes
v3.0 (2025.09.23)
  • ✅ Added continuationIndex() function - Ehlers' Continuation Index from TASC 2025.09
  • ✅ Enhanced trend analysis capabilities with advanced filtering techniques
  • ✅ Improved documentation with comprehensive function references
  • ✅ Integration of Inverse Fisher Transform-based trend detection algorithms


New Functions in v3.0:

continuationIndex(source, length, gamma, order)
Calculates the Continuation Index of a given data series. The index represents the Inverse Fisher Transform of the normalized difference between an UltimateSmoother and an N-order Laguerre filter. Developed by John F. Ehlers, published in TASC 2025.09.

Parameters:
source (series float): Series of values to process.
length (simple int): The calculation length.
gamma (simple float): Controls the phase response of the Laguerre filter. Optional, default is 0.8.
order (simple int): The order of the Laguerre filter. Must be a value from 1 to 10. Optional, default is 8.

Returns: (float) The calculated Continuation Index value.

laguerreBinomialFilter(source, length, gamma)
Calculates the Laguerre Binomial Filter of a given data series. Laguerre Binomial Filter uses 6-pole feedback with binomial weighting coefficients. Uses Pascal's triangle weights for enhanced smoothness characteristics.

Parameters:
source (series float): Series of values to process.
length (simple int): Length for UltimateSmoother preprocessing.
gamma (simple float): Feedback coefficient (0-1). Lower values reduce lag. Optional, default is 0.5.

Returns: (float) The calculated Laguerre Binomial Filter value.

Modified Functions in v3.0:

laguerreFilter(source, length, gamma, order)
Updated to standard N-order Laguerre Filter with uniform weighting. Changed from 6-pole binomial version to mathematical standard version. Added order parameter for flexible lag control.

Parameters:
source (series float): Series of values to process.
length (simple int): Length for UltimateSmoother preprocessing.
gamma (simple float): Feedback coefficient (0-1). Lower values reduce lag. Optional, default is 0.8 (changed from 0.5).
order (simple int): The order of the Laguerre filter (1-10). Higher order increases lag. Optional, default is 8.

Returns: (float) The calculated standard Laguerre Filter value.

v2.0 (2025.09.23)
  • ✅ Added ma() universal moving average interface with unified MaType enum support
  • ✅ Added atr() function with customizable MA type for True Range smoothing
  • ✅ Added macd() function with customizable MA types for main and signal lines
  • ✅ Support for flexible combinations of 21 moving average algorithms in complex indicators
  • ✅ Enhanced volatility and trend analysis tools with professional-grade implementations
  • ✅ Expanded MaType enumeration to include all supported moving average types


New Functions in v2.0:

ma(source, length, maType)
Calculates a Moving Average based on the specified type. Universal interface supporting all implemented moving average algorithms. Provides a unified way to switch between different MA types for comparison and optimization.

Parameters:
source (series float): Series of values to process.
length (simple int): Number of bars for moving average calculation.
maType (simple MaType): Type of moving average to calculate. Optional, default is SMA.

Returns: (float) The calculated moving average value based on the specified type.

atr(length, maType)
Calculates the Average True Range (ATR) using the specified moving average type. ATR measures market volatility by averaging the True Range over a specified period. Supports multiple moving average algorithms for smoothing the True Range values.

Parameters:
length (simple int): Number of bars for ATR calculation.
maType (simple MaType): Type of moving average to use for smoothing. Optional, default is RMA.

Returns: (float) The calculated Average True Range value.

macd(source, fastLength, slowLength, signalLength, maType, signalMaType)
Calculates the Moving Average Convergence Divergence (MACD) with customizable MA types. MACD shows the relationship between two moving averages of a security's price. Supports different moving average algorithms for both main MACD calculation and signal line.

Parameters:
source (series float): Series of values to process.
fastLength (simple int): Period for the fast moving average. Common values: 5-15.
slowLength (simple int): Period for the slow moving average. Common values: 20-35.
signalLength (simple int): Period for the signal line moving average. Common values: 5-15.
maType (simple MaType): Type of moving average for main MACD calculation. Optional, default is EMA.
signalMaType (simple MaType): Type of moving average for signal line calculation. Optional, default is EMA.

Returns: ([float, float, float]) Tuple containing MACD line, signal line, and histogram values.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.