OPEN-SOURCE SCRIPT

Uptrick: EMA SMA Support Resistance Histogram

Atualizado
Purpose:
The "Uptrick: EMA SMA Support Resistance Histogram" indicator, known by its short title 'UESH,' is meticulously crafted to offer traders a comprehensive view of potential support and resistance levels, leveraging the crossovers between the Exponential Moving Average (EMA) and Simple Moving Average (SMA). Its distinctive feature lies in the visualization of these crossovers through histogram bars, providing traders with an intuitive representation of market momentum and possible reversal points.

Explanation:

Input Parameters:
Traders benefit from the flexibility to tailor the length of both the SMA and EMA according to their trading strategies and market preferences.
The 'Source' parameter allows users to select the data series upon which the calculations are based, typically the closing price.
Additionally, the option to toggle the visibility of the histogram enhances the indicator's adaptability to different analytical approaches.
Moving Averages:
The script diligently computes both the SMA and EMA based on the specified lengths and the chosen data source.
The SMA (Simple Moving Average) acts as a smoothing mechanism, averaging price data over a defined period to discern underlying trends.
On the other hand, the EMA (Exponential Moving Average) places greater weight on recent price data, making it more responsive to short-term price fluctuations.
Cross Detection:
A hallmark of this indicator is its adeptness in identifying crossover and crossunder events between the EMA and SMA, signaling potential shifts in market sentiment.
A green color is assigned to the EMA when it crosses above the SMA (crossover), indicating bullish momentum.
Conversely, a red color is applied when the EMA crosses below the SMA (crossunder), signaling bearish momentum.
In the absence of a crossover, both lines are colored blue, denoting a neutral state.
Support and Resistance Visualization through Histogram Bars:
A notable feature of this indicator is its ability to delineate potential support and resistance levels through histogram bars.
The script calculates the disparity between the source data and the SMA, effectively capturing deviations from the prevailing trend.
Positive deviations (source above SMA) are represented by green histogram bars, highlighting potential support zones.
Conversely, negative deviations (source below SMA) manifest as red histogram bars, indicating potential resistance areas.
The length of the histogram bars is customizable, allowing traders to fine-tune the sensitivity to price movements based on their preferences and trading strategies.

In summary through it's dynamic features and meticulous design, this indicator empowers traders with actionable insights into market dynamics, facilitating informed trading decisions with regards to potential support and resistance levels. The inclusion of histogram bars enhances its analytical prowess, providing a visual representation of price deviations and reinforcing traders' ability to interpret market sentiment effectively.
Notas de Lançamento
UPDATE

The script is transformed into version 6 as well!

### Inputs

1. Extended Input Options:
- filter_noise: This floating-point input sets a threshold to filter out minor fluctuations between the EMA and SMA, reducing false signals caused by market noise.
- show_signals: A boolean input that allows users to toggle the display of buy and sell signals on the chart.
- metrics_table_enabled: A boolean input to enable or disable the display of a metrics table, providing real-time data insights directly on the chart.
- advanced_alerts: A boolean input that enables advanced alert conditions, allowing for more sophisticated notification triggers.
- trend_threshold: A floating-point input that sets the minimum trend strength required to consider the trend as strong, aiding in identifying significant market movements.

### Moving Averages Calculation and Plotting

2. SMA and EMA Calculations:
- The script calculates the Simple Moving Average (SMA) and Exponential Moving Average (EMA) using the user-defined lengths and the selected source price.

3. Cross Detection with Noise Filtering:
- cross_up and cross_down: Detect when EMA crosses above or below SMA.
- valid_cross_up and valid_cross_down: These conditions ensure that the cross is significant by comparing the absolute difference between EMA and SMA against the filter_noise threshold.

4. Color Assignment Based on Crosses:
- color_sma and color_ema: The colors of SMA and EMA lines change based on whether a valid cross has occurred, enhancing visual cues for bullish or bearish trends.

5. Enhanced Plotting with Multiple Shadow Layers:
- SMA Shadows: Multiple shadow layers with varying transparency and linewidths create a layered shadow effect beneath the SMA line, making it stand out.
- EMA Shadows: Similar shadow layering is applied to the EMA, with different colors for bullish and bearish conditions.
- SMA and EMA Lines: The main SMA and EMA lines are plotted with bright, thin lines (linewidth=2) on top of the shadow layers for clarity.

### Histogram Enhancements

6. Support/Resistance Histogram:
- hist_length: Defines the length of the histogram array.
- supportStrength Array: Stores the difference between the source price and SMA over a specified length, providing a historical view of support and resistance levels.
- Plotting the Histogram: The histogram is plotted only if showHistogram is enabled, using different colors based on whether the source price is above or below the SMA.

### Metrics Calculation and Table

7. Comprehensive Metrics Calculation:
- current_ema and current_sma: Current values of EMA and SMA.
- trend_strength: The absolute difference between EMA and SMA, indicating the strength of the trend.
- directional_bias: Indicates whether the trend is bullish or bearish based on EMA and SMA comparison.
- relative_positioning: Shows the percentage difference between the source price and SMA, indicating overbought or oversold conditions.
- moving_average_slope: Calculates the slope of the SMA, showing the rate of change.
- macd_distance: Measures the distance between EMA and SMA, similar to trend strength.
- mean_reversion_probability: Indicates the likelihood of the price reverting to the mean based on EMA and SMA positions.
- moving_average_lag: Describes whether the moving average is lagging bullishly or bearishly.
- overbought_oversold: Flags if the source price is overbought or oversold relative to SMA.
- crossover_momentum: Measures the momentum based on the difference between source price and EMA.
- moving_average_channel_width: The width between EMA and SMA, indicating volatility.
- ema_weighted_signal: An EMA of the difference between source price and EMA, providing a smoothed signal.

8. Updating Metrics Table:
- The table is dynamically updated on each bar if metrics_table_enabled is true, ensuring real-time data is always displayed.

### Buy and Sell Signals

9. Signal Conditions:
- buy_signal: Triggered when a valid upward cross occurs or when EMA is above SMA and the source price crosses above EMA.
- sell_signal: Triggered when a valid downward cross occurs or when EMA is below SMA and the source price crosses below EMA.

10. Plotting Signals:
- plotshape: Visual indicators (labels) for buy and sell signals are plotted on the chart when conditions are met, making it easier to identify entry and exit points.

### Bar Coloring

11. Dynamic Bar Coloring:
- barcolor_signal: Bars are colored bullishly or bearishly based on whether EMA is above or below SMA.

### Alerts

12. Alert Conditions:
- alertcondition: Alerts are set up for buy and sell signals, allowing users to receive notifications when these conditions are met. This is particularly useful for automated trading strategies or staying informed without constant monitoring.

### Conclusion

The updated script in version 6 significantly enhances the functionality and visual appeal of the indicator. By introducing multiple shadow layers, a comprehensive metrics table, advanced alert conditions, and dynamic bar coloring, the script provides a more robust tool for analyzing trends, identifying trading signals, and monitoring market conditions. These improvements offer deeper insights and greater flexibility for traders, enabling more informed decision-making.
Moving AveragesTrend AnalysisVolume

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?


✨ Exclusive indicators indicators codes on Discord for free!

📲 Discord: discord.gg/Def47ueyuD

✨ Premium indicators: uptrick.io
Também em:

Aviso legal