The resource loading... loading...

Advanced Timeframe Fibonacci Retracement with High-Low Breakout Trading System

Author: ChaoZhang, Date: 2024-11-28 15:01:25
Tags: HTFFIBOHLMABBRSI

img

Overview

This strategy is an advanced trading system that combines multiple technical analysis tools, primarily based on higher timeframe Fibonacci retracement levels and price high-low breakout conditions to generate trading signals. The strategy dynamically calculates higher timeframe price data, combining Fibonacci retracement levels and customized price breakout conditions to form a complete trading decision system. This approach considers both overall market trends and short-term price breakouts, capable of capturing potential trading opportunities at market turning points.

Strategy Principles

The strategy’s core logic is built on three main pillars: First is the higher timeframe price analysis, establishing a more macro market perspective through calculating daily or higher timeframe OHLC prices. Second is the dynamic calculation of Fibonacci retracement levels, setting key support and resistance levels based on the higher timeframe price range. Finally, price breakout determination through setting highest and lowest prices over lookback periods as breakout references. Buy signals are triggered when price breaks above recent lows and crosses above the 50% Fibonacci retracement level, while sell signals are generated when price breaks below recent highs and falls below the 50% Fibonacci retracement level.

Strategy Advantages

  1. Multi-dimensional analysis: Combines the most respected elements in technical analysis, including price action, trend following, and support/resistance.
  2. High adaptability: Parameters can be adjusted according to different market conditions, including time periods, lookback periods, and Fibonacci levels.
  3. Comprehensive risk management: Reduces false breakout risk through multiple confirmation mechanisms.
  4. High visualization: All key price levels are clearly visible on the chart, facilitating trading decisions.
  5. Strong flexibility: Applicable to various trading instruments and time periods.

Strategy Risks

  1. Parameter sensitivity: Different lookback period settings may lead to significant differences in signal quality.
  2. Market condition dependency: May generate excessive false signals in ranging markets.
  3. Lag risk: Due to the use of lookback period data, may miss optimal entry points in fast-moving markets.
  4. Over-optimization risk: Excessive parameter optimization may lead to poor future performance.

Strategy Optimization Directions

  1. Add volatility filtering: Recommend adding indicators like ATR or Bollinger Bandwidth to filter low volatility periods.
  2. Integrate trend filtering: Can add moving average systems to confirm overall trend direction.
  3. Optimize entry timing: Can improve entry timing by incorporating momentum indicators like RSI.
  4. Dynamic parameter adjustment: Introduce adaptive mechanisms to automatically adjust parameters based on market conditions.
  5. Enhanced risk control: Add dynamic stop-loss and profit target settings.

Summary

This is a well-designed trading system that creates a theoretically sound and practical trading strategy by combining multiple classic technical analysis tools. The strategy’s greatest feature is its ability to provide more reliable trading signals through multi-dimensional analysis while maintaining sufficient flexibility to adapt to different market environments. While there are some inherent risks, the strategy’s stability and reliability can be further enhanced through the suggested optimization directions. For traders willing to invest time in parameter optimization and strategy improvement, this is an excellent basic framework.


/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Fibonacci Levels Strategy with High/Low Criteria", overlay = true)

// Kullanıcıdan yüksek zaman dilimini ve mum bilgilerini al
timeframe = input.timeframe(defval = "D", title = "Higher Time Frame")
currentlast = input.string(defval = "Last", title = "Current or Last HTF Candle", options = ["Current", "Last"])

// Kullanıcıdan en düşük ve en yüksek fiyat bakış sürelerini al
lowestLookback = input(20, "Lowest Price Lookback", tooltip="The strategy will BUY when the price crosses over the lowest it has been in the last X amount of bars")
highestLookback = input(10, "Highest Price Lookback", tooltip="If Take-Profit is not checked, the strategy will SELL when the price crosses under the highest it has been in the last X amount of bars")

// Fibonacci seviyeleri ayarları
level0 = input.float(defval = 0.000, title = "Level 0")
level1 = input.float(defval = 0.236, title = "Level 1")
level2 = input.float(defval = 0.382, title = "Level 2")
level3 = input.float(defval = 0.500, title = "Level 3")
level4 = input.float(defval = 0.618, title = "Level 4")
level5 = input.float(defval = 0.786, title = "Level 5")
level100 = input.float(defval = 1.000, title = "Level 100")

// HTF mumlarını hesapla
newbar = ta.change(time(timeframe)) != 0 
var float htfhigh = high
var float htflow = low
var float htfopen = open
float htfclose = close
var counter = 0

if newbar
    htfhigh := high
    htflow := low
    htfopen := open
    counter := 0
else
    htfhigh := math.max(htfhigh, high)
    htflow := math.min(htflow, low)
    counter += 1

var float open_ = na
var float high_ = na
var float low_ = na
var float close_ = na
if currentlast == "Last" and newbar
    open_ := htfopen[1]
    high_ := htfhigh[1]
    low_ := htflow[1]
    close_ := htfclose[1]
else if currentlast == "Current"
    open_ := htfopen
    high_ := htfhigh
    low_ := htflow
    close_ := htfclose

// Fibonacci seviyelerini hesapla
var float[] fibLevels = array.new_float(6)
array.set(fibLevels, 0, open_ + (high_ - low_) * level0)
array.set(fibLevels, 1, open_ + (high_ - low_) * level1)
array.set(fibLevels, 2, open_ + (high_ - low_) * level2)
array.set(fibLevels, 3, open_ + (high_ - low_) * level3)
array.set(fibLevels, 4, open_ + (high_ - low_) * level4)
array.set(fibLevels, 5, open_ + (high_ - low_) * level5)

// Fibonacci seviyelerini grafik üzerine çiz
plot(array.get(fibLevels, 0), color=color.new(color.blue, 75), title="Fibonacci Level 0")
plot(array.get(fibLevels, 1), color=color.new(color.green, 75), title="Fibonacci Level 1")
plot(array.get(fibLevels, 2), color=color.new(color.red, 75), title="Fibonacci Level 2")
plot(array.get(fibLevels, 3), color=color.new(color.orange, 75), title="Fibonacci Level 3")
plot(array.get(fibLevels, 4), color=color.new(color.teal, 75), title="Fibonacci Level 4")
plot(array.get(fibLevels, 5), color=color.new(color.navy, 75), title="Fibonacci Level 5")

// En düşük ve en yüksek fiyat kriterlerini hesapla
lowcriteria = ta.lowest(low, lowestLookback)[1]
highcriteria = ta.highest(high, highestLookback)[1]

plot(highcriteria, color=color.green, title="Highest Price Criteria")
plot(lowcriteria, color=color.red, title="Lowest Price Criteria")

// Fibonacci seviyeleri ile ticaret sinyalleri oluştur
longCondition = close > lowcriteria and close > array.get(fibLevels, 3) // En düşük kriterin ve Fibonacci seviyesinin üstüne çıkarsa alım
shortCondition = close < highcriteria and close < array.get(fibLevels, 3) // En yüksek kriterin ve Fibonacci seviyesinin altına düşerse satış

if (longCondition)
    strategy.entry("Long", strategy.long)

if (shortCondition)
    strategy.entry("Short", strategy.short)


Related

More