All indicators

Bollinger and Stochastic with Trailing Stop - D.M.P.

Feb 15, 2024

Static chart image
SignalsOscillatorsMoving AveragesTrailing-StopVolatility

The Bollinger and Stochastic with Trailing Stop - D.M.P. tool identifies potential mean-reversion opportunities by detecting confluence between price exhaustion at volatility extremes and momentum oscillators to improve entry precision.

Usage

The Usage section describes how the script can be used to identify trend exhaustion and manage trades. Traders can utilize this script to spot oversold and overbought conditions in any timeframe, provided the market displays mean-reverting characteristics.

  • Long Entries: A long signal is generated when the price closes below the lower Bollinger Band while the Stochastic %K line is below the 20 level. This indicates that price is stretched beyond its typical volatility range and momentum is bottoming out.
  • Short Entries: A short signal is triggered when the price closes above the upper Bollinger Band and the Stochastic %K line is above 80. This suggests the market is overextended to the upside.
  • Exit Management: The strategy utilizes an automated ATR-based trailing stop. As the price moves in the direction of the trade, the stop loss adjusts dynamically to lock in profits, protecting the trader from sudden reversals.

Details

The script integrates three core technical analysis concepts to provide a comprehensive trading framework:

  • Bollinger Bands: These bands act as dynamic support and resistance levels. By using a standard deviation (typically 2.0) around a moving average, the indicator identifies price levels that are statistically significant outliers.
  • Stochastic Oscillator: This momentum indicator functions as a filter. It ensures that trades are only taken when the price is not just at a band extreme, but also showing signs of momentum exhaustion in the oversold or overbought zones.
  • ATR-Based Trailing Stop: Unlike fixed stop losses, the Average True Range (ATR) exit adapts to current market volatility. By using a multiplier (e.g., 1.5x ATR), the script ensures that the trailing stop is wide enough to survive minor noise but tight enough to exit when the trend changes.

This refactored version, originally by @dmtz77, features optimized alert logic and refined visual outputs for better clarity on charting platforms.

Settings

  • Longitud BB: Sets the lookback period for the Bollinger Bands basis (Moving Average).
  • Desviación Estándar BB: Adjusts the width of the Bollinger Bands; higher values require more extreme price movement for a signal.
  • Longitud K Estocástico: Determines the period used for the raw Stochastic calculation.
  • Longitud D Estocástico: Sets the smoothing period for the %D line.
  • Suavizado Estocástico: Applies internal smoothing to the %K line to reduce market noise.
  • Longitud ATR: Defines the period for the Average True Range calculation used in risk management.
  • Multiplicador ATR para Trailing Stop: Sets the distance between the current price and the trailing stop based on the ATR value.

FAQ

How does the trailing stop work? The trailing stop uses the ATR value multiplied by a user-defined factor. Once a trade is entered, the exit level follows the price movement at this set distance, only moving in the direction of the trade to protect accumulated gains.

Can I change the sensitivity of the entry signals? Yes, by decreasing the Bollinger Band Standard Deviation or increasing the Stochastic levels, you can make the entry requirements more stringent, resulting in fewer but potentially higher-quality signals.

How do I get access to Bollinger and Stochastic with Trailing Stop - D.M.P.? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.