OPEN-SOURCE SCRIPT

Sell Signals EMA+SMA

Updated
Indicator Overview:
This indicator identifies sell signals based on candlestick patterns, volume conditions, and moving average confirmations. It also plots support and resistance levels based on pivot highs and pivot lows. You can configure different settings like pivot lengths, moving average periods, and candlestick pattern conditions for the sell signals.

Configurable Settings:
Pivot High Length: Defines the number of bars used to calculate the resistance levels (pivot highs).
Pivot Low Length: Defines the number of bars used to calculate the support levels (pivot lows).
Volume SMA Length: The period of the simple moving average (SMA) for volume. Used to filter signals based on high volume.
Close SMA Length: The period of the simple moving average (SMA) for the close price. Used for confirmation of sell signals.
Pin Bar High Ratio: The ratio for defining the size of the upper wick in a bearish pin bar.
Pin Bar Low Ratio: The ratio for defining the size of the lower wick in a bearish pin bar.
How It Works:
Support and Resistance:

The indicator plots red lines for resistance (pivot highs) and green lines for support (pivot lows).
These levels are updated as new pivot points are detected based on the configured pivot lengths.
Sell Signal Conditions:

Candlestick Patterns: The indicator checks for two bearish patterns:
Bearish Pin Bar: A candle with a large upper wick and small lower wick where the close is below the open.
Bearish Engulfing: A candle where the current close is lower than the previous low, and the current open is higher than the previous high.
Volume Condition: The volume must be above the configured simple moving average (SMA) of the volume.
Confirmation: A sell signal is confirmed only when the price crosses below the configured SMA for the close price.
Sell Signals:

If all the conditions (candlestick pattern, volume, and confirmation) are met, the indicator will plot a red "Sell" label above the candle.
Additionally, a blue triangle will appear above the candle to indicate that the sell signal has been confirmed.
How to Use:
Adjust the Settings:

Open the settings of the indicator and adjust the parameters like pivot lengths, moving average periods, and candlestick pattern ratios based on your preferences.
Identify Key Levels:

Watch the red resistance and green support lines to identify key levels where price may reverse.
Look for Sell Signals:

When a red "Sell" label appears, it indicates a possible sell opportunity.
Ensure that a blue triangle (confirmation) also appears to validate the sell signal.
Manage Risk:

Use the support and resistance levels along with the sell signals to define your entry, stop-loss, and take-profit levels.
This indicator helps you identify potential bearish reversal points with configurable settings for added flexibility.






Release Notes
How the Script Works:
Pivot Points:

The script calculates pivot highs and pivot lows using user-defined lengths. These pivots can serve as important levels of support and resistance. Green lines represent support levels (pivot lows), and red lines represent resistance levels (pivot highs).
These pivot points are drawn only for the last 1000 bars to maintain clarity and efficiency.
Volume and Confirmation:

The script calculates a simple moving average (SMA) of volume over a user-defined period (default: 20 bars). For a signal to be valid, the volume of the current bar must be greater than this volume SMA.
The script also uses the close SMA to confirm buy and sell signals. When the price crosses under the close SMA, a sell confirmation occurs. When the price crosses above the close SMA, a buy confirmation occurs.
Candlestick Patterns:

Pin Bar (Bearish and Bullish): The script identifies Pin Bar patterns where the candlestick has a long upper wick (for bearish) or a long lower wick (for bullish), indicating potential price reversals.
Bearish Pin Bar: Long upper wick, small body, and close lower than open.
Bullish Pin Bar: Long lower wick, small body, and close higher than open.
Engulfing Pattern (Bearish and Bullish): The script detects Engulfing patterns, where the current candlestick fully engulfs the previous one.
Bearish Engulfing: Current candlestick closes below the previous low, with the body larger than the previous candlestick.
Bullish Engulfing: Current candlestick closes above the previous high, with the body larger than the previous candlestick.
Sell Signals:

Sell signals are generated when either the Pin Bar Bearish or Engulfing Bearish pattern is detected, along with a confirmation of high volume.
The sell signal is confirmed when the price crosses below the close SMA.
Sell signals are displayed as red upward arrows labeled "Sell" above the candlestick.
Buy Signals:

Buy signals are generated when either the Pin Bar Bullish or Engulfing Bullish pattern is detected, along with a confirmation of high volume.
The buy signal is confirmed when the price crosses above the close SMA.
Buy signals are displayed as green downward arrows labeled "Buy" below the candlestick.
Confirmation Indicators:

When a signal (buy or sell) is generated, the confirmation is shown with a blue triangle. For buy confirmations, triangles point upwards, and for sell confirmations, triangles point downwards.
How to Adjust the Settings:
Pivot High and Low Length:

You can change the length of the pivot highs and lows using the Pivot High Length and Pivot Low Length input settings. This will determine how many candles to consider before identifying a pivot point.
Volume SMA Length:

The Volume SMA Length setting allows you to adjust the period over which the moving average of volume is calculated. A higher length will smooth out volume fluctuations.
Close SMA Length:

The Close SMA Length defines the period for the moving average of the closing price, which is used to confirm the buy and sell signals.
Candlestick Pattern Sensitivity:

You can adjust the Pin Bar High Ratio and Pin Bar Low Ratio to fine-tune the sensitivity of the Pin Bar patterns. The default settings are:
Pin Bar High Ratio: 0.66 for the bearish Pin Bar (defines how long the upper wick should be relative to the entire candlestick).
Pin Bar Low Ratio: 0.33 for the bullish Pin Bar (defines how long the lower wick should be relative to the entire candlestick).
Practical Use Cases:
Buy and Sell Confirmation: You can use the script as a confirmation tool for existing strategies by only acting on signals when both the candlestick pattern and volume confirmation are present.
Scalping or Swing Trading: This script can be used in both lower time frames (e.g., 1-minute or 5-minute charts) for scalping or in higher time frames (e.g., daily charts) for swing trading.
Reversals and Continuations: The candlestick patterns help you identify potential market reversals, while the confirmation with SMA ensures you only take trades with momentum in your favor.
Key Tips:
Adjust the settings based on market conditions: In more volatile markets, you may want to reduce the length of the moving averages for quicker signals. In slower markets, longer periods can help filter out noise.
Volume is key: For the signals to be valid, the current volume should be above the moving average of volume. This helps you avoid false signals in low liquidity periods.
Candlestick analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer