OPEN-SOURCE SCRIPT

Custom EMA/ATR/Keltner/Bollinger with Squeeze Setup

21-EMA and ATR-Based Analysis
21-EMA (Exponential Moving Average):

Acts as a dynamic support/resistance level.
The price's relationship with the 21-EMA is used to detect trends and potential reversals.
ATR (Average True Range):

Measures volatility.
Used to define price thresholds for buy/sell conditions (e.g., price not more than 1 ATR above 21-EMA for a buy signal).
2. Bollinger Bands and Keltner Channels for Squeeze Setup
Bollinger Bands (BB):

Calculated using a 20-period simple moving average and standard deviations.
Represents high and low volatility zones.
Keltner Channels (KC):

Based on a 20-period EMA and ATR.
Provides narrower channels for price action compared to Bollinger Bands.
Squeeze Condition:

Occurs when Bollinger Bands fall inside Keltner Channels, signaling low volatility.
These periods often precede significant price movements (breakouts).
3. Momentum Indicator (MACD Histogram)
MACD Histogram:
Measures momentum during a squeeze.
Positive histogram values suggest bullish momentum, while negative values suggest bearish momentum.
Used to predict breakout direction from a squeeze.
4. RSI (Relative Strength Index) for Overbought/Oversold Conditions
Buy Signal:
RSI below 50 indicates a potential oversold condition, supporting a buy signal.
Sell Signal:
RSI above 80 indicates overbought conditions, supporting a sell signal.
5. Buy/Sell Signal Conditions
Buy Signal:

Price is not more than 1 ATR above the 21-EMA.
RSI is below 50 (oversold).
Price touches the 21-EMA within a small tolerance.
Squeeze condition is active.
Sell Signal:

Price is 3 ATR above the 21-EMA.
RSI is above 80 (overbought).
Additional Signals:

Buy: Price is 2 standard deviations below the 21-EMA.
Sell: Price is 2 standard deviations above the 21-EMA.
6. Visual Enhancements
Chart patternsforecastingMoving Averages

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明