Skip to content

Latest commit

 

History

History
269 lines (168 loc) · 8.1 KB

布林带和斐波那契交易策略Bollinger-Bands-and-Fibonacci-Trading-Strategy.md

File metadata and controls

269 lines (168 loc) · 8.1 KB

Name

布林带和斐波那契交易策略Bollinger-Bands-and-Fibonacci-Trading-Strategy

Author

ChaoZhang

Strategy Description

[trans]

概述

本策略融合布林带指标和斐波那契回撤指标,实现多指标组合交易。属于典型的组合指标策略类型。策略通过布林带判断趋势方向,斐波那契回撤确定关键支持阻力位,从而产生交易信号。

策略原理

该策略主要基于以下两个指标进行判断:

  1. 布林带

    计算布林带中的上轨、中轨和下轨。价格突破下轨时为做多信号,突破上轨时为做空信号。

  2. 斐波那契回撤

    根据历史高点和低点计算出0%和100%两重要斐波那契回撤位。这两点可作为关键的支持和阻力位。

具体交易逻辑为:

做多信号:价格上穿布林带上轨,且处于0%斐波那契支持上方

做空信号:价格下穿布林带下轨,且处于100%斐波那契阻力下方

平仓以中轨为参考,中轨附近止盈或止损。

策略优势

  • 组合布林带和斐波那契两个指标
  • 布林带判断趋势方向,斐波那契确定关键点位
  • 两者组合过滤误信号概率较小
  • 中轨附近止盈止损,回撤控制到位
  • 入场退出规则清晰,易于操作

策略风险

  • 均线指标容易滞后,可能错过最佳点位
  • 仅基于指标,对重大突发事件反应不够敏捷
  • 双重过滤条件限制交易频次过少
  • 参数设置不当会影响布林带和回撤效果
  • 不同品种需要分别测试优化参数

可以通过以下措施来降低风险:

  • 优化参数,找出最佳参数组合
  • 适当放宽入场条件,例如加入K线形态
  • 优化止盈止损机制,例如追踪止损
  • 分别测试不同品种的最佳参数
  • 适当调整仓位管理系统

优化方向

该策略可以从以下几个方面进行优化:

  1. 优化布林带参数

    寻找计算上下轨最佳的参数比例

  2. 优化斐波那契回撤周期

    测试计算回撤的不同周期参数

  3. 放宽入场条件

    例如布林带突破时观察K线形态

  4. 优化止盈止损机制

    考虑带有追踪功能的止损方式

  5. 根据不同品种分别测试

    不同品种参数不一定相同,需要调整

总结

本策略通过组合布林带和斐波那契回撤指标,发挥各自的技术优势,提高了交易信号的质量。但也存在参数优化难度大,入场条件太严格等问题。我们可以通过优化参数设定、适当放宽入场条件、改进止损机制等方法来完善策略系统,在保留其技术优势的同时,争取更多的交易机会。同时,持续根据回测结果进行调整也是使策略更加稳健的关键。

||

Overview

This strategy combines the Bollinger Bands and Fibonacci retracement indicators for a multi-indicator approach. It belongs to the typical combined indicators strategy type. The Bollinger Bands determine the trend direction and the Fibonacci levels identify key support and resistance zones for generating trading signals.

Strategy Logic

The strategy is based on two main indicators:

  1. Bollinger Bands

    Calculates the upper, middle and lower bands. Price breaking above lower band is long signal, and breaking below upper band is short signal.

  2. Fibonacci Retracements

    Calculates the 0% and 100% retracement levels based on historical highs and lows. These act as key support and resistance levels.

The specific trading logic is:

Long signal: Price breaks above upper band, and is above 0% Fibonacci support.

Short signal: Price breaks below lower band, and is below 100% Fibonacci resistance.

Exits are around the middle band for take profit or stop loss.

Advantages

  • Combines Bollinger Bands and Fibonacci indicators
  • Bands judge trend, Fibonacci identifies key levels
  • Combined probability of false signals is lower
  • Middle band exits control drawdowns
  • Clear entry and exit rules, easy to implement

Risks

  • MA-based indicators can lag, missing best levels
  • Purely indicator-driven, slow reaction to major events
  • Dual filters limit trading frequency
  • Improper parameters negatively affect bands and retracements
  • Parameters need optimization for different products

Risks can be reduced by:

  • Optimizing for best parameter combinations
  • Relaxing entry criteria like adding candlestick patterns
  • Improving exits with trailing stops
  • Separate parameter testing by product
  • Adjusting position sizing system

Enhancement Directions

The strategy can be improved by:

  1. Optimizing Bollinger Bands parameters

    Finding optimal ratios for upper/lower bands

  2. Optimizing Fibonacci retracement periods

    Testing different lookback periods for retracements

  3. Relaxing entry conditions

    Observing candlestick patterns on band breaks

  4. Improving exits

    Considering trailing stop mechanisms

  5. Product-specific parameter testing

    Parameters need tuning for different products

Summary

This strategy combines the strengths of Bollinger Bands and Fibonacci Retracements for higher quality signals. But challenges like difficult parameter optimization exist. Improvements can be made through parameter tuning, relaxing entry criteria, enhancing exits etc. to refine the strategy while retaining its edge. Continual adjustments based on backtest results are also key for robustness.

[/trans]

Strategy Arguments

Argument Default Description
v_input_int_1 20 Bollinger Bands Length
v_input_1_close 0 Source: close
v_input_float_1 2 Standard Deviation Multiplier
v_input_float_2 false Fibonacci 0% Level
v_input_float_3 true Fibonacci 100% Level

Source (PineScript)

/*backtest
start: 2023-09-13 00:00:00
end: 2023-09-20 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Bollinger Bands & Fibonacci Strategy", shorttitle="BB & Fib Strategy", overlay=true)

// Initialize position variables
var bool long_position = false
var bool short_position = false

// Bollinger Bands settings
length = input.int(20, title="Bollinger Bands Length")
src = input(close, title="Source")
mult = input.float(2.0, title="Standard Deviation Multiplier")

basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)

upper_band = basis + dev
lower_band = basis - dev

// Fibonacci retracement levels
fib_0 = input.float(0.0, title="Fibonacci 0% Level", minval=-100, maxval=100) / 100
fib_100 = input.float(1.0, title="Fibonacci 100% Level", minval=-100, maxval=100) / 100

// Plotting Bollinger Bands
plot(upper_band, color=color.red, title="Upper Bollinger Band")
plot(lower_band, color=color.green, title="Lower Bollinger Band")

// Calculate Fibonacci levels
fib_range = ta.highest(high, 50) - ta.lowest(low, 50)
fib_high = ta.highest(high, 50) - fib_range * fib_0
fib_low = ta.lowest(low, 50) + fib_range * fib_100

// Plot Fibonacci retracement levels
plot(fib_high, color=color.blue, title="Fibonacci High")
plot(fib_low, color=color.orange, title="Fibonacci Low")

// Entry conditions
long_condition = ta.crossover(close, upper_band) and low > fib_low
short_condition = ta.crossunder(close, lower_band) and high < fib_high

// Plot arrows on the chart
plotshape(series=long_condition, title="Long Entry", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=short_condition, title="Short Entry", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)

// Entry and exit logic
if long_condition and not short_position
    strategy.entry("Long", strategy.long)
    long_position := true
    short_position := false

if short_condition and not long_position
    strategy.entry("Short", strategy.short)
    short_position := true
    long_position := false

// Exit conditions (you can customize these)
long_exit_condition = ta.crossunder(close, basis)
short_exit_condition = ta.crossover(close, basis)

if long_exit_condition
    strategy.close("Long")
    long_position := false

if short_exit_condition
    strategy.close("Short")
    short_position := false


Detail

https://www.fmz.com/strategy/427516

Last Modified

2023-09-21 21:04:38