TechnicalAnalysis

📊 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
Basic Usage Example
Advanced Trading System
📋 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
- ✅ 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
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Haftungsausschluss
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.