OPEN-SOURCE SCRIPT

Shendeng - ATR + Trend + EMA

This is a custom technical indicator that combines multiple smoothing and weighted calculation steps to capture changes in price momentum. The specific calculation process is as follows:

1. PMI_LA Indicator
Smoothing Period (sm): Used to apply exponential moving average (EMA) multiple times to smooth price data.
Constant D (cd): Used to adjust the sensitivity and shape of the indicator.
Color Bars (ebc) and Ribbon Mode (ribm): Used for visual highlighting of the indicator.
Overview of the Calculation Process:

Apply EMA multiple times to smooth price data.
Use multiple weighted coefficients (based on cd) to linearly combine the smoothed data, generating the final PMI_LA trend line.
Dynamically adjust its color based on changes in the trend line (green indicates rising, red indicates falling, blue indicates no change).

2. ATR (Average True Range)
ATR (Average True Range) is an indicator that measures market volatility by calculating the price fluctuation over a certain period.
ATR Period (c): Defines the number of historical periods required for ATR calculation.
ATR Multiplier (a): Used to adjust the impact of ATR, thereby affecting the upper and lower bands of the trend line.

3. EMA (Exponential Moving Average)
EMA (Exponential Moving Average) is used to generate a smooth price trend line. Although in the code the EMA period is set to 1 (i.e., ema(src_bsi, 1)), its main role is to assist in calculating trend changes.

4. Heikin Ashi Candles (Optional)
Heikin Ashi Candles are an improved candlestick display method, aiming to filter out market noise and provide a clearer trend illustration. Through the parameter h, users can choose whether to use Heikin Ashi candlestick data for calculation.

5. Logic and Conditions
BUY: When the price breaks above the ATR-adjusted upper band from below, and the EMA crosses above the upper band, indicating that the market may be starting a new upward trend, issuing a buy signal.
SELL: When the price breaks below the ATR-adjusted lower band from above, and the EMA crosses below the lower band, indicating that the market may be starting a new downward trend, issuing a sell signal.


这是一个自定义的技术指标,结合了多个平滑和加权计算步骤,以捕捉价格动量的变化。具体计算过程如下:

1.PMI_LA 指标
平滑周期(Smoothing Period, sm):用于多次应用指数移动平均(EMA)以平滑价格数据。
常数D(Constant D, cd):用于调整指标的灵敏度和形状。
颜色条(Color Bars, ebc) 和 带状模式(Ribbon Mode, ribm):用于视觉上的指标高亮。

计算过程概述:
多次应用EMA平滑价格数据。
使用多个加权系数(基于cd)对平滑后的数据进行线性组合,生成最终的PMI_LA趋势线。
根据趋势线的变化,动态调整其颜色(绿色表示上升,红色表示下降,蓝色表示无变化)。

2. ATR(平均真实波幅)
ATR(Average True Range) 是一种衡量市场波动性的指标,通过计算一定周期内的价格波动幅度来评估市场的波动性。
ATR周期(ATR Period, c):定义了ATR计算所需的历史周期数。
ATR倍数(ATR Multiplier, a):用于调整ATR的影响力度,进而影响趋势线的上下轨。

3. EMA(指数移动平均线)
EMA(Exponential Moving Average) 用于生成一个平滑的价格趋势线。虽然在代码中EMA的周期设置为1(即ema(src_bsi, 1)),但其主要作用是辅助计算趋势变化。

4. Heikin Ashi 蜡烛图(可选)
Heikin Ashi Candles 是一种改进的蜡烛图显示方式,旨在过滤掉市场噪音,提供更清晰的趋势图示。通过参数h,用户可以选择是否使用Heikin Ashi蜡烛图的数据进行计算。

5.逻辑与条件:
BUY:当价格从下方向上突破ATR调整后的上轨,并且EMA上穿上轨时,表明市场可能开始一个新的上升趋势,发出买入信号。
SELL:当价格从上方向下突破ATR调整后的下轨,并且EMA下穿下轨时,表明市场可能开始一个新的下降趋势,发出卖出信号。
Average True Range (ATR)Exponential Moving Average (EMA)Relative Strength Index (RSI)

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?

Aviso legal