OPEN-SOURCE SCRIPT
Atualizado

Normalized Price Comparison

544
Normalized Price Comparison Indicator Description

The "Normalized Price Comparison" indicator is designed to provide traders with a visual tool for comparing the price movements of up to three different financial instruments on a common scale, despite their potentially different price ranges. Here's how it works:

Features:
Normalization: This indicator normalizes the closing prices of each symbol to a scale between 0 and 1 over a user-defined period. This normalization process allows for the comparison of price trends regardless of the absolute price levels, making it easier to spot relative movements and trends.
Crossing Alert: It features an alert functionality that triggers when the normalized price lines of the first two symbols (Symbol 1 and Symbol 2) cross each other. This can be particularly useful for identifying potential trading opportunities when one asset's relative performance changes against another.
Customization: Users can input up to three symbols for analysis. The normalization period can be adjusted, allowing flexibility in how historical data is considered for the scaling process. This period determines how many past bars are used to calculate the minimum and maximum prices for normalization.
Visual Representation: The indicator plots these normalized prices in a separate pane below the main chart. Each symbol's normalized price is represented by a distinct colored line:
Symbol 1: Blue line
Symbol 2: Red line
Symbol 3: Green line

Use Cases:
Relative Performance Analysis: Ideal for investors or traders who want to compare how different assets are performing relative to each other over time, without the distraction of absolute price differences.
Divergence Detection: Useful for spotting divergences where one asset might be outperforming or underperforming compared to others, potentially signaling changes in market trends or investment opportunities.
Crossing Strategy: The alert for when Symbol 1 and Symbol 2's normalized lines cross can be used as a part of a trading strategy, signaling potential entry or exit points based on relative price movements.

Limitations:
Static Alert Messages: Due to Pine Script's constraints, the alert messages cannot dynamically include the names of the symbols being compared. The alert will always mention "Symbol 1" and "Symbol 2" crossing.
Performance: Depending on the timeframe and the number of symbols, performance might be affected, especially on lower timeframes with high data frequency.

This indicator is particularly beneficial for those interested in multi-asset analysis, offering a streamlined way to observe and react to relative price movements in a visually coherent manner. It's a powerful tool for enhancing your trading or investment analysis by focusing on trends and relationships rather than raw price data.
Notas de Lançamento
Added built in levels
Notas de Lançamento
Added feature*

Performance Difference Indicator:


We've introduced an innovative feature to the "Normalized Price Comparison" indicator that enhances your ability to analyze and interpret market trends through a new visual metric. This feature adds:

Performance Difference Histogram: A histogram located at the bottom of the indicator panel that dynamically illustrates the relative performance between two normalized price series (Composite Symbol 1 and Composite Symbol 2). This histogram represents the difference between these normalized values, adjusted by the movement of the actual pair symbol (Symbol 3). The bars of the histogram are:
Green when Composite Symbol 1 is outperforming or increasing more than Composite Symbol 2, considering the adjustment by the actual pair's price movement.
Red when Composite Symbol 2 is outperforming or showing stronger growth than Composite Symbol 1, again with the adjustment for the actual pair's performance.
Directional Indicator: Accompanying the histogram, a simple yet effective directional arrow ('↑' or '↓') appears at the bottom of the chart. This visual cue:
↑ Indicates when the performance of Composite Symbol 1 is leading.
↓ Indicates when Composite Symbol 2 is taking the lead in performance.

This feature provides a quick, at-a-glance understanding of which normalized price series is gaining more ground relative to the other, while also considering the broader market context via the actual pair's movement. It's particularly useful for traders looking to spot divergences or confirmations between different market indices or assets, offering insights into which market might have a stronger influence or "lead" in current market conditions. This can help in decision-making for trading strategies, asset allocation, or simply in understanding market dynamics more intuitively.
Notas de Lançamento
*interface update
Notas de Lançamento
bug fix*
Notas de Lançamento
/*
Updates from Original Code:
1. **Dynamic Normalization with Volatility Scaling**:
- Original: Normalized prices to a 0-1 range (scaled to 0-100) based on min/max over a fixed period, causing flattening at extremes (0 or 100).
- Updated: Normalizes prices as deviations from a moving average (SMA over 'scalePeriod'), scaled by standard deviation (volatility). This eliminates flattening, allowing values to exceed bounds and reflect true outperformance/underperformance.

2. **Histogram Scaling Control**:
- Original: Histogram ('performanceDiff') used raw normalized differences, often resulting in extreme values that distorted the chart scale.
- Updated: Introduced a 'histScale' factor (default 0.5) to dampen the histogram’s amplitude, keeping it proportional and less intrusive while preserving its trend indication.

Benefits and Usefulness:
- **No Flattening at Extremes**: The new normalization shows the full extent of price movements (e.g., +3 or -3 standard deviations), making it easier to spot significant outperformance or underperformance that was previously capped.
- **Better Comparability**: Scaling by volatility ensures each symbol’s movements are proportionate to its own behavior, improving visual comparison across diverse instruments.
- **Controlled Histogram**: The adjustable histogram scale prevents it from overwhelming the chart, keeping focus on the price lines while still providing performance insights.
- **Flexibility**: Users can tweak 'scalePeriod' for normalization sensitivity and 'histScale' for histogram prominence, tailoring the indicator to their specific needs.
*/

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.