Bollinger Crossing Death Golden Strategy

Author: ChaoZhang, Date: 2024-02-21 14:19:12



This strategy is a Bollinger Bands crossover strategy based on the Bollinger Bands indicator. By adjusting the parameters of Bollinger Bands, it is optimized for gold trading. It generates buy signals when the price closes above the upper band and sell signals when the price closes below the lower band.

Strategy Logic

The strategy uses Bollinger Bands with a length of 50 and a multiplier of 2.5. The middle band of the Bollinger Bands is the SMA line of the price, the upper band is the middle band plus the multiplier of the standard deviation, and the lower band is the middle band minus the multiplier of the standard deviation.

When the price closes above the upper band, a buy signal is generated. When the price closes below the lower band, a sell signal is generated. It utilizes the feature of narrowing of the Bollinger Bands channels and generates signals when the breakout occurs after channel contraction.

Advantage Analysis

The advantages of this strategy include:

  1. The optimized parameters fit gold trading and profit is steady.

  2. Utilize the channel feature of Bollinger Bands to generate signals after reduced price fluctuation, avoiding missing opportunities.

  3. The crossover system is easy to follow for manual trading.

  4. The graphical display is intuitive to monitor the price movement within the bands.

Risk Analysis

There are also some risks with this strategy:

  1. Inappropriate Bollinger Bands parameters may cause false signals. Parameters need to be tested and optimized.

  2. Frequent trading increases costs and slippage. Parameters can be adjusted to lower trading frequency.

  3. It is easy to hit stop loss when gold fluctuates greatly. Stop loss points can be adjusted or position management can be added.


The strategy can be optimized from the following aspects:

  1. Test parameters on different markets and time frames to find the optimal parameter combination.

  2. Add position management module to generate additional entry signals through moving average, channel breakouts, etc.

  3. Add stop loss module, using trailing stops to follow price moves.

  4. Incorporate other indicators to filter out false signals and improve strategy stability.


The strategy optimizes Bollinger Bands for gold trading by adjusting parameters. It utilizes the expansion and contraction of Bollinger Bands to generate signals. There is large room for improvement in parameters optimization, position management, stop loss. Overall, the strategy has simple logic, good stability, and is suitable for manual gold trading.

start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

strategy("Optimized Bollinger Bands Strategy for Gold", overlay=true)

// Bollinger Bands Settings
length = input(50, title="BB Length", minval=1)
mult = input(2.5, title="Multiplier", minval=0.001, maxval=50)

// Bollinger Bands
basis = sma(close, length)
upper = basis + mult * stdev(close, length)
lower = basis - mult * stdev(close, length)

// Plotting
plot(upper,, title="Upper Band", linewidth=2)
plot(lower,, title="Lower Band", linewidth=2)

// Highlight the region between upper and lower bands
bgcolor(upper > lower ?, 90) : na)

// Buy Signal with arrow
longCondition = crossover(close, upper)
plotshape(series=longCondition, title="Buy Signal",, style=shape.triangleup, text="Buy", location=location.belowbar, size=size.small)

// Sell Signal with arrow
shortCondition = crossunder(close, lower)
plotshape(series=shortCondition, title="Sell Signal",, style=shape.triangledown, text="Sell", location=location.abovebar, size=size.small)

// Strategy
strategy.entry("Buy", strategy.long, when=longCondition)
strategy.entry("Sell", strategy.short, when=shortCondition)