OPEN-SOURCE SCRIPT

Chieu - Bollinger Bands SMA 50 Strategy

Overview

The Custom Bollinger Bands Indicator is a versatile tool designed to help traders identify potential market reversals and optimize their trading strategies. This indicator combines Bollinger Bands with an ATR-based stop-loss mechanism, configurable take-profit levels, and dynamic position sizing to manage risk effectively. By highlighting key market conditions and providing clear visual cues, it enables traders to make informed decisions and execute trades with precision.
Key Features

Bollinger Bands Calculation:
The indicator calculates Bollinger Bands based on a configurable Simple Moving Average (SMA) length.
Standard deviation multiplier is adjustable, allowing traders to fine-tune the width of the bands.

Candlestick Highlighting:
Candles that touch the upper or lower Bollinger Bands are highlighted, indicating potential overbought or oversold conditions.
Reversal candles are identified and highlighted based on specific criteria:
The candle must touch the Bollinger Bands for two consecutive periods.
The reversal candle must have a body at least twice the size of the previous candle's body.
The reversal candle must close in the opposite direction to the previous candle (e.g., a bullish candle following a bearish one).

Stop-Loss and Take-Profit Levels:
Stop-loss levels are calculated using the ATR (Average True Range) indicator, ensuring they are dynamically adjusted based on market volatility.
Two configurable take-profit levels (1R and 2R) are plotted based on the initial risk (distance between entry and stop-loss).
Take-profit and stop-loss lines are visually represented on the chart for easy reference.

Position Sizing and Risk Management:
The indicator includes configurable inputs for account balance, leverage, and risk percentage.
It calculates the nominal value (position size without leverage) and cost value (position size with leverage) based on the specified risk parameters.
Combined labels display SL, TP, nominal value, and cost value, replacing the default "Reversal" text for clear, concise information.

Customization Options:
Users can configure the length of the take-profit lines.
The option to toggle the highlighting of candles touching the Bollinger Bands on or off, while always highlighting the identified reversal candles.

How to Use

Configuration:
Set the desired SMA length and Bollinger Bands multiplier in the input settings.
Configure the ATR length for accurate stop-loss calculations.
Adjust the risk-reward ratio and take-profit line length according to your trading strategy.
Specify your account balance, leverage, and risk percentage for precise position sizing.

Chart Analysis:
Monitor the chart for candles touching the upper or lower Bollinger Bands. These highlights indicate potential overbought or oversold conditions.
Look for highlighted reversal candles, which meet the specified criteria and suggest a potential market reversal.
Use the plotted stop-loss and take-profit lines to manage your trades effectively. The combined labels provide all necessary information (SL, TP, nominal value, and cost value) for quick decision-making.

Execution and Risk Management:
Enter trades based on the reversal candle signals.
Set your stop-loss at the indicated level using the ATR calculation.
Take partial profits at the first take-profit level (1R) and adjust your stop-loss to the entry point to secure the remaining position.
Exit the trade entirely at the second take-profit level (2R) or if the price returns to the adjusted stop-loss level.
Average True Range (ATR)Bollinger Bands (BB)

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