INVITE-ONLY SCRIPT
Actualizado

Pro Bollinger Bands Strategy [Breno]

61
This strategy excels in highly volatile financial instruments, including cryptocurrencies, high-beta stocks, commodity futures, and certain exchange-traded funds (ETFs) that exhibit clear mean-reversion characteristics around their Bollinger Bands. The system's ability to utilize scaling (position averaging) and an ATR-based stop loss makes it particularly effective in markets with significant price swings, allowing the trader to capture profits from price extremes while managing increased volatility-related risk.

Core Strategy Logic
This Strategy implements a comprehensive trend-following and mean-reversion strategy primarily leveraging the Bollinger Bands (BB) indicator for entry and exit signals, complemented by an Average True Range (ATR)-based Stop Loss mechanism and an optional EMA filter. It is designed with robust features for capital management, including configurable leverage and a sophisticated position averaging (scaling) system.

  • Long Entry: A long position is initiated when the closing price crosses over the Lower Bollinger Band (ta.crossover(close,lowerBB)). This signals a potential mean-reversion opportunity following a price dip.

  • Short Entry: A short position is initiated when the closing price crosses under the Upper Bollinger Band (ta.crossunder(close,upperBB)). (Note: Short entries are disabled by default in the script inputs).

  • Exit Conditions (Profit Target): Long positions aim to exit upon interaction with the Upper Bollinger Band. Users can select from three exit methods:
    1. "Close When Touch": Exits when close≥upperBB.

    2. "Close Above then Below": Exits when the previous close was above the upper band, and the current close is below it (a reversal signal).

    3. "High Above": Exits when high>upperBB. The strategy features an optional profitOnly setting, which restricts all exits to only occur if the trade is currently in profit (i.e., close is above the strategy.position_avg_price for longs).


Key Features and Customization

Bollinger Bands & Filters -
  • Customizable BB Parameters: The Length and Deviation of the Bollinger Bands are fully adjustable, allowing users to fine-tune the sensitivity of the entry and exit signals.

  • Optional EMA Filter: An optional EMA Filter can be enabled to align entries with the prevailing trend, where a Long entry is only permitted if close≥EMA(EmaFilterRange).


Risk and Capital Management -
  • Equity Allocation: Position size is dynamically calculated based on a Percentage of Equity (capitalPerc) combined with the set Leverage multiplier.

  • Dynamic Stop Loss (ATR-Based):
    An optional Stop Loss (SL) is calculated using a multiple (slAtrInput) of the Average True Range (ATR).

    The SL is set relative to the entry price upon trade activation, providing a volatility-adjusted risk management layer.
  • Position Averaging (Scaling): The script supports the addition of multiple units (pyramiding) to an existing position based on three user-selected criteria:
    1. "No": No averaging.

    2. "Percent": Adds to the position if the price has dropped by a set percentage (addPct) from the average price.

    3. "ATR": Adds to the position if the current price is significantly below a calculated ATR-based support level from the average price.
Notas de prensa
This strategy excels in highly volatile financial instruments, including cryptocurrencies, high-beta stocks, commodity futures, and certain exchange-traded funds (ETFs) that exhibit clear mean-reversion characteristics around their Bollinger Bands. The system's ability to utilize scaling (position averaging) and an ATR-based stop loss makes it particularly effective in markets with significant price swings, allowing the trader to capture profits from price extremes while managing increased volatility-related risk.

Core Strategy Logic
This Strategy implements a comprehensive trend-following and mean-reversion strategy primarily leveraging the Bollinger Bands (BB) indicator for entry and exit signals, complemented by an Average True Range (ATR)-based Stop Loss mechanism and an optional EMA filter. It is designed with robust features for capital management, including configurable leverage and a sophisticated position averaging (scaling) system.

  • Long Entry: A long position is initiated when the closing price crosses over the Lower Bollinger Band (ta.crossover(close,lowerBB)). This signals a potential mean-reversion opportunity following a price dip.

  • Short Entry: A short position is initiated when the closing price crosses under the Upper Bollinger Band.

  • Exit Conditions (Profit Target): Long positions aim to exit upon interaction with the Upper Bollinger Band. Users can select from three exit methods:
    1. "Close When Touch": Exits when close≥upperBB.
    2. "Close Above then Below": Exits when the previous close was above the upper band, and the current close is below it (a reversal signal).
    3. "High Above": Exits when high>upperBB. The strategy features an optional profitOnly setting, which restricts all exits to only occur if the trade is currently in profit.


Key Features and Customization

Bollinger Bands & Filters -
  • Customizable BB Parameters: The Length and Deviation of the Bollinger Bands are fully adjustable, allowing users to fine-tune the sensitivity of the entry and exit signals.
  • Optional EMA Filter: An optional EMA Filter can be enabled to align entries with the prevailing trend, where a Long entry is only permitted if close≥EMA(EmaFilterRange).


Risk and Capital Management -
  • Equity Allocation: Position size is dynamically calculated based on a Percentage of Equity combined with the set Leverage multiplier.
  • Dynamic Stop Loss (ATR-Based):
    An optional Stop Loss (SL) is calculated using a multiple (slAtrInput) of the Average True Range (ATR).
    The SL is set relative to the entry price upon trade activation, providing a volatility-adjusted risk management layer.
  • Position Averaging (Scaling): The script supports the addition of multiple units (pyramiding) to an existing position based on three user-selected criteria:
    • "No": No averaging.
    • "Percent": Adds to the position if the price has dropped by a set percentage (addPct) from the average price.
    • "ATR": Adds to the position if the current price is significantly below a calculated ATR-based support level from the average price.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.