PINE LIBRARY

NormalizedIndicators

48
NormalizedIndicators - Comprehensive Trend Normalization Library
Overview

This Pine Script™ library provides an extensive collection of normalized trend-following indicators and calculation functions for technical analysis. The main advantage of this library lies in its unified signal output: All trend indicators are normalized to a standardized format where 1 represents a bullish signal, -1 represents a bearish signal, and 0 (where applicable) represents a neutral signal.
This normalization enables traders to seamlessly combine different indicators, create consensus signals, and develop complex multi-indicator strategies without worrying about different scales and interpretations.

📊 Categories
The library is divided into two main categories:
1. Trend-Following Indicators
2. Calculation Indicators

🔄 Trend-Following Indicators
Stationary Indicators
These oscillate around a fixed value and are not bound to price.
BBPct() - Bollinger Bands Percent

Source: Algoalpha X Sushiboi77
Parameters:

Length: Period for Bollinger Bands
Factor: Standard deviation multiplier
Source: Price source (typical: close)


Logic: Calculates the position of price within the Bollinger Bands as a percentage
Signal:

1 (bullish): when positionBetweenBands > 50
-1 (bearish): when positionBetweenBands ≤ 50


Special Feature: Uses an array to store historical standard deviations for additional analysis

RSI() - Relative Strength Index

Source: TradingView
Parameters:

len: RSI period
src: Price source
smaLen: Smoothing period for RSI


Logic: Classic RSI with additional SMA smoothing
Signal:

1 (bullish): RSI-SMA > 50
-1 (bearish): RSI-SMA < 50
0 (neutral): RSI-SMA = 50




Non-Stationary Indicators
These follow price movement and have no fixed boundaries.
NorosTrendRibbonSMA() & NorosTrendRibbonEMA()

Source: ROBO_Trading
Parameters:

Length: Moving average and channel period
Source: Price source


Logic: Creates a price channel based on the highest/lowest MA value over a specified period
Signal:

1 (bullish): Price breaks above upper band
-1 (bearish): Price breaks below lower band
0 (neutral): Price within channel (maintains last state)


Difference: SMA version uses simple moving averages, EMA version uses exponential

TrendBands()

Source: starlord_xrp
Parameters: src (price source)
Logic: Uses 12 EMAs (9-30 period) and checks if all are rising or falling simultaneously
Signal:

1 (bullish): All 12 EMAs are rising
-1 (bearish): All 12 EMAs are falling
0 (neutral): Mixed signals


Special Feature: Very strict conditions - extremely strong trend filter

Vidya() - Variable Index Dynamic Average

Source: loxx
Parameters:

source: Price source
length: Main period
histLength: Historical period for volatility calculation


Logic: Adaptive moving average that adjusts to volatility
Signal:

1 (bullish): VIDYA is rising
-1 (bearish): VIDYA is falling



VZO() - Volume Zone Oscillator

Parameters:

source: Price source
length: Smoothing period
volumesource: Volume data source


Logic: Combines price and volume direction, calculates the ratio of directional volume to total volume
Signal:

1 (bullish): VZO > 14.9
-1 (bearish): VZO < -14.9
0 (neutral): VZO between -14.9 and 14.9



TrendContinuation()

Source: AlgoAlpha
Parameters:

malen: First HMA period
malen1: Second HMA period
theclose: Price source


Logic: Uses two Hull Moving Averages for trend assessment with neutrality detection
Signal:

1 (bullish): Uptrend without divergence
-1 (bearish): Downtrend without divergence
0 (neutral): Trend and longer MA diverge



LeonidasTrendFollowingSystem()

Source: LeonidasCrypto
Parameters:

src: Price source
shortlen: Short EMA period
keylen: Long EMA period


Logic: Simple dual EMA crossover system
Signal:

1 (bullish): Short EMA < Key EMA
-1 (bearish): Short EMA ≥ Key EMA



ysanturtrendfollower()

Source: ysantur
Parameters:

src: Price source
depth: Depth of Fibonacci weighting
smooth: Smoothing period
bias: Percentage bias adjustment


Logic: Complex system with Fibonacci-weighted moving averages and bias bands
Signal:

1 (bullish): Weighted MA > smoothed MA (with upward bias)
-1 (bearish): Weighted MA < smoothed MA (with downward bias)
0 (neutral): Within bias zone



TRAMA() - Trend Regularity Adaptive Moving Average

Source: LuxAlgo
Parameters:

src: Price source
length: Adaptation period


Logic: Adapts to trend regularity - accelerates in stable trends, slows in consolidations
Signal:

1 (bullish): Price > TRAMA
-1 (bearish): Price < TRAMA
0 (neutral): Price = TRAMA



HullSuite()

Source: InSilico
Parameters:

_length: Base period
src: Price source
_lengthMult: Length multiplier


Logic: Uses Hull Moving Average with lagged comparisons for trend determination
Signal:

1 (bullish): Current Hull > Hull 2 bars ago
-1 (bearish): Current Hull < Hull 2 bars ago
0 (neutral): No change



STC() - Schaff Trend Cycle

Source: shayankm (described as "Better MACD")
Parameters:

length: Cycle period
fastLength: Fast MACD period
slowLength: Slow MACD period
src: Price source


Logic: Combines MACD concepts with stochastic normalization for early trend signals
Signal:

1 (bullish): STC is rising
-1 (bearish): STC is falling




🧮 Calculation Indicators
These functions provide specialized mathematical calculations for advanced analysis.
LCorrelation() - Long-term Correlation

Creator: unicorpusstocks
Parameters:

Input: First time series
Compare: Second time series


Logic: Calculates the average of correlations across 6 different periods (30, 60, 90, 120, 150, 180)
Returns: Correlation value between -1 and 1
Application: Long-term relationship analysis between assets, markets, or indicators

MCorrelation() - Medium-term Correlation

Creator: unicorpusstocks
Parameters:

Input: First time series
Compare: Second time series


Logic: Calculates the average of correlations across 6 different periods (15, 30, 45, 60, 75, 90)
Returns: Correlation value between -1 and 1
Application: Medium-term relationship analysis with higher sensitivity

assetBeta() - Beta Coefficient

Creator: unicorpusstocks
Parameters:

measuredSymbol: The asset to be measured
baseSymbol: The reference asset (e.g., market index)


Logic:

Calculates Beta across 4 different time horizons (50, 100, 150, 200 periods)
Beta = Correlation × (Asset Standard Deviation / Market Standard Deviation)
Returns the average of all 4 Beta values


Returns: Beta value (typically 0-2, can be higher/lower)
Interpretation:

Beta = 1: Asset moves in sync with the market
Beta > 1: Asset more volatile than market
Beta < 1: Asset less volatile than market
Beta < 0: Asset moves inversely to the market




💡 Usage Examples
Example 1: Multi-Indicator Consensus
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1 as lib

// Combine multiple indicators
signal1 = lib.BBPct(20, 2.0, close)
signal2 = lib.RSI(14, close, 5)
signal3 = lib.TRAMA(close, 50)

// Consensus signal: At least 2 of 3 must agree
consensus = (signal1 + signal2 + signal3)
strongBuy = consensus >= 2
strongSell = consensus <= -2
Example 2: Correlation-Filtered Trading
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1 as lib

// Only trade when strong correlation with market exists
spy = request.security("SPY", timeframe.period, close)
correlation = lib.MCorrelation(close, spy)

trendSignal = lib.NorosTrendRibbonEMA(50, close)

// Only bullish signals with positive correlation
tradeBuy = trendSignal == 1 and correlation > 0.5
tradeSell = trendSignal == -1 and correlation > 0.5
Example 3: Beta-Adjusted Position Sizing
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1 as lib

spy = request.security("SPY", timeframe.period, close)
beta = lib.assetBeta(close, spy)

// Adjust position size based on Beta
basePositionSize = 100
adjustedSize = basePositionSize / beta // Less size with high Beta

⚙️ Technical Details
Normalization Standard

Bullish: 1
Bearish: -1
Neutral: 0 (only for selected indicators)

Advantages of Normalization

Simple Aggregation: Signals can be added/averaged
Consistent Interpretation: No confusion about different scales
Strategy Development: Simplified logic for backtesting
Combinability: Seamlessly mix different indicator types

Performance Considerations

All functions are optimized for Pine Script v5
Proper use of var for state management
Efficient array operations where needed
Minimal recursive calls


📋 License
This code is subject to the Mozilla Public License 2.0. More details at: mozilla.org/MPL/2.0/

🎯 Use Cases
This library is ideal for:

Quantitative Traders: Systematic strategy development with unified signals
Multi-Timeframe Analysis: Consensus across different timeframes
Portfolio Managers: Beta and correlation analysis for diversification
Algo Traders: Machine learning with standardized features
Retail Traders: Simplified signal interpretation without deep technical knowledge


🔧 Installation
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1
Then use the functions with your chosen alias:
pinescriptlib.BBPct(20, 2.0, close)
lib.RSI(14, close, 5)
// etc.

⚠️ Important Notes

All indicators are lagging, as is typical for trend-following indicators
Signals should be combined with additional analysis (volume, support/resistance, etc.)
Backtesting is recommended before starting live trading with these signals
Different assets and timeframes may require different parameter optimizations


This library provides a solid foundation for professional trading system design with the flexibility to develop your own complex strategies while abstracting away technical complexity.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.