OPEN-SOURCE SCRIPT
Updated

Cross PB

284
This Pine Script v6 indicator identifies potential trend changes using crossovers of two moving averages (fast and slow), enhanced by a candlestick body confirmation mechanism. It provides two distinct signal types for refined entry/exit points.
Key Features:
Dual Signal System Based on Candle Close:
Alert 1 (Buy/Sell): Triggers after a bullish crossover (fast MA crosses above slow MA) AND a bearish candle (close < open) closes below the fast MA. The inverse applies for a sell signal (bearish crossover + bullish candle + close above fast MA).
Alert 2 (Buy/Sell): Similar to Alert 1, but the candle close condition is checked relative to the slow MA, providing a broader price zone validation.
Moving Average Flexibility: Allows independent selection of length, price source (close, hl2, hlc3, etc.), and type (SMA, EMA, WMA, HMA, ALMA, TMA, TSMA, KAMA, AMA, etc.) for all three moving averages.
Alert Control: Independently enable or disable alerts for buy/sell signals of type 1 and type 2.
Visualization: Plots all three moving averages on the chart for visual tracking of their interactions.
Usage:
The indicator aims to capture the start of trends. The logic of using a bearish candle to confirm a bullish signal (and vice-versa) might represent a dynamic of rejection or consolidation immediately after the crossover before a new trend effectively begins. This can help filter out standard false moving average crossover signals.
Release Notes
Cross PB - Moving Average Crossover Indicator with Candlestick Confirmation
This Pine Script v6 indicator identifies potential trend reversal or continuation signals based on the most recent crossover of two moving averages (fast and slow), validated by the subsequent candlestick body position.
Key Features:
Last Crossover Logic: The indicator continuously tracks the type (bullish or bearish) and timing of the most recent crossover between the fast and slow moving averages.
Candlestick Confirmation: A signal is triggered only when a new candle meets specific criteria after the last crossover event.
BUY Signal: Generated if the last crossover was bullish (fast MA crossed above slow MA) AND a subsequent candle is bearish (close < open) AND its close is below either the fast MA or the slow MA.
SELL Signal: Generated if the last crossover was bearish (fast MA crossed below slow MA) AND a subsequent candle is bullish (close > open) AND its close is above either the fast MA or the slow MA.
Flexible Moving Averages: Allows independent selection of length, price source (close, hl2, hlc3, etc.), and type (SMA, EMA, WMA, HMA, ALMA, TMA, TSMA, KAMA, AMA, etc.) for all three moving averages (the third is plotted as a reference line).
Configurable Alerts: Separate options to enable/disable the BUY and SELL alerts.
Visualization: Plots all three moving averages on the chart for visual reference.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.