Pro Bollinger Bands Strategy [Breno]

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:
- "Close When Touch": Exits when close≥upperBB.
- "Close Above then Below": Exits when the previous close was above the upper band, and the current close is below it (a reversal signal).
- "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).
- "Close When Touch": Exits when close≥upperBB.
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:
- "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.
- "No": No averaging.
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:
- "Close When Touch": Exits when close≥upperBB.
- "Close Above then Below": Exits when the previous close was above the upper band, and the current close is below it (a reversal signal).
- "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.
- "Close When Touch": Exits when close≥upperBB.
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.
- "No": No averaging.
סקריפט להזמנה בלבד
רק משתמשים שאושרו על ידי המחבר יכולים לגשת לסקריפט הזה. יהיה עליך לשלוח בקשת גישה ולקבל אישור לשימוש. בדרך כלל, הגישה ניתנת לאחר תשלום. למידע נוסף, עקוב אחר ההוראות של היוצר בהמשך או צור קשר עם brenosilver ישירות.
TradingView לא ממליצה לשלם עבור סקריפט או להשתמש בו אלא אם כן אתה סומך לחלוטין על המחבר שלו ומבין כיצד הוא פועל. ייתכן שתוכל גם למצוא חלופות חינמיות וקוד פתוח ב-סקריפטים הקהילתיים שלנו.
הוראות המחבר
כתב ויתור
סקריפט להזמנה בלבד
רק משתמשים שאושרו על ידי המחבר יכולים לגשת לסקריפט הזה. יהיה עליך לשלוח בקשת גישה ולקבל אישור לשימוש. בדרך כלל, הגישה ניתנת לאחר תשלום. למידע נוסף, עקוב אחר ההוראות של היוצר בהמשך או צור קשר עם brenosilver ישירות.
TradingView לא ממליצה לשלם עבור סקריפט או להשתמש בו אלא אם כן אתה סומך לחלוטין על המחבר שלו ומבין כיצד הוא פועל. ייתכן שתוכל גם למצוא חלופות חינמיות וקוד פתוח ב-סקריפטים הקהילתיים שלנו.