OPEN-SOURCE SCRIPT

4H Bollinger Breakout Strategy

319
This strategy leverages Bollinger Bands on the 4-hour timeframe for long and short trades in trending or ranging markets. Entries trigger on BB breakouts with optional filters for volume, trend, and RSI. Exits occur on opposite BB crosses. Customizable for long-only, short-only, or indicator mode via code comments. Supports forex, stocks, or crypto with full equity allocation and 0.1% commission.

Length (Default: 20): Period for BB basis and std dev; shorter for sensitivity, longer for smoothing.

Basis MA Type (Default: SMA): Selects MA for middle band (SMA, EMA, etc.); EMA for faster response.

Source (Default: Close): Price input for calculations; use close for standard accuracy.

StdDev Multiplier (Default: 1.8): Band width control; higher for fewer signals, lower for more.

Offset (Default: 0): Shifts BB plots; typically unchanged.

Use Filters (Default: True): Applies volume, trend, RSI checks to filter signals.

Volume MA Length (Default: 20): For volume filter (long: >105% avg, short: >120%).

Trend MA Length (Default: 80): SMA for trend filter (long: above MA, short: below).

RSI Length (Default: 14): For short filter (entry if RSI <85).

Use Long/Short Signals (Defaults: True): Toggles directions; long entry on lower BB crossover, short on upper crossunder.

Visuals: BB plots (blue basis, red upper, green lower), orange trend MA, filled background.

Labels/Alerts: Green/red for long entry/exit, yellow/purple for short; alert conditions included.

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.