この戦略は,フィボナッチリトレースメント理論に基づいた適応型多レベル取引システムである.フィボナッチリトレースメントレベルを使用して,市場の主要なサポートおよびレジスタンスレベルを特定し,これらのレベルとの価格相互作用に基づいて取引信号を生成する.この戦略の核心は柔軟性にあります.トレーダーは,バックバック期,フィボナッチ方向,および市場状況および個人的な好みに合わせてエントリーレベルなどの主要なパラメータを調整することができます.
戦略の基本論理には次のステップが含まれます.
この戦略のユニークさは,ユーザがフィボナッチ計算の方向 (上から下へまたは下から上へ) を選択し,購入・販売シグナルのための異なるフィボナッチレベルを選択することを可能にする.この柔軟性は,戦略が異なる市場環境と取引スタイルに適応することを可能にします.
このリスクを軽減するために,以下を考慮してください.
これらの最適化により,戦略の適応性と強度が著しく向上し,より幅広い市場条件において有効性を維持することが可能になります.
フィボナッチリトラセメントに基づく適応型多レベル取引戦略は,金融市場における潜在的な取引機会を特定するための柔軟でカスタマイズ可能な枠組みを提供します.この戦略は,伝統的な技術分析原理と近代的なリスク管理技術を組み合わせることで,トレーダーにさまざまな市場環境で高い確率の取引機会を探すために強力なツールを提供します.しかし,すべての取引戦略と同様に,それは間違いないものではありません.この戦略の効果的な適用には,その原則の深い理解,注意的なパラメータ調整,および他の分析ツールとの統合が必要です.継続的な最適化とリスク管理を通じて,この戦略はトレーダーのツールキットにおける強力な武器になることができます.
/*backtest start: 2024-08-26 00:00:00 end: 2024-09-24 08:00:00 period: 4h basePeriod: 4h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Simple Fibonacci Retracement Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10) // Input period for high and low points identification lookback = input.int(100, title="Lookback Period", minval=10) // Input to choose Fibonacci calculation direction fib_direction = input.string(title="Fibonacci Direction", defval="Top to Bottom", options=["Top to Bottom", "Bottom to Top"]) // Input for Fibonacci levels fib_level_236 = input.float(0.236, title="Fib 23.6% Level") fib_level_382 = input.float(0.382, title="Fib 38.2% Level") fib_level_50 = input.float(0.5, title="Fib 50% Level") fib_level_618 = input.float(0.618, title="Fib 61.8% Level") // Input to choose the level for entry signals buy_entry_level = input.string(title="Buy Entry Level", defval="Fib 61.8%", options=["Fib 23.6%", "Fib 38.2%", "Fib 50%", "Fib 61.8%"]) sell_entry_level = input.string(title="Sell Entry Level", defval="Fib 38.2%", options=["Fib 23.6%", "Fib 38.2%", "Fib 50%", "Fib 61.8%"]) // Input for take profit and stop loss in pips take_profit_pips = input.int(50, title="Take Profit (pips)") stop_loss_pips = input.int(20, title="Stop Loss (pips)") // Identify high and low points within the lookback period highestHigh = ta.highest(high, lookback) lowestLow = ta.lowest(low, lookback) // Calculate Fibonacci levels based on the selected direction var float fib_0 = na var float fib_100 = na var float fib_236 = na var float fib_382 = na var float fib_50 = na var float fib_618 = na if fib_direction == "Top to Bottom" fib_0 := highestHigh fib_100 := lowestLow fib_236 := highestHigh - (highestHigh - lowestLow) * fib_level_236 fib_382 := highestHigh - (highestHigh - lowestLow) * fib_level_382 fib_50 := highestHigh - (highestHigh - lowestLow) * fib_level_50 fib_618 := highestHigh - (highestHigh - lowestLow) * fib_level_618 else fib_0 := lowestLow fib_100 := highestHigh fib_236 := lowestLow + (highestHigh - lowestLow) * fib_level_236 fib_382 := lowestLow + (highestHigh - lowestLow) * fib_level_382 fib_50 := lowestLow + (highestHigh - lowestLow) * fib_level_50 fib_618 := lowestLow + (highestHigh - lowestLow) * fib_level_618 // Determine which level to use for buy and sell signals based on user input var float buy_fib_level = na var float sell_fib_level = na if buy_entry_level == "Fib 23.6%" buy_fib_level := fib_236 if buy_entry_level == "Fib 38.2%" buy_fib_level := fib_382 if buy_entry_level == "Fib 50%" buy_fib_level := fib_50 if buy_entry_level == "Fib 61.8%" buy_fib_level := fib_618 if sell_entry_level == "Fib 23.6%" sell_fib_level := fib_236 if sell_entry_level == "Fib 38.2%" sell_fib_level := fib_382 if sell_entry_level == "Fib 50%" sell_fib_level := fib_50 if sell_entry_level == "Fib 61.8%" sell_fib_level := fib_618 // Convert pips to price units (assuming 1 pip = 0.0001 for currency pairs like EURUSD) pip_value = syminfo.mintick * 10 take_profit = take_profit_pips * pip_value stop_loss = stop_loss_pips * pip_value // Trading signals var bool longSignal = na var bool shortSignal = na if fib_direction == "Top to Bottom" longSignal := ta.crossover(close, buy_fib_level) and close > buy_fib_level shortSignal := ta.crossunder(close, sell_fib_level) and close < sell_fib_level else longSignal := ta.crossover(close, buy_fib_level) and close > buy_fib_level shortSignal := ta.crossunder(close, sell_fib_level) and close < sell_fib_level // Execute trades based on signals with take profit and stop loss if (longSignal) strategy.entry("Long", strategy.long, comment="BUY") strategy.exit("Take Profit/Stop Loss", "Long", limit=close + take_profit, stop=close - stop_loss) if (shortSignal) strategy.entry("Short", strategy.short, comment="SELL") strategy.exit("Take Profit/Stop Loss", "Short", limit=close - take_profit, stop=close + stop_loss) // Plot Fibonacci levels plot(fib_0, title="Fib 0%", color=color.blue, linewidth=1, style=plot.style_line) plot(fib_236, title="Fib 23.6%", color=color.green, linewidth=1, style=plot.style_line) plot(fib_382, title="Fib 38.2%", color=color.green, linewidth=1, style=plot.style_line) plot(fib_50, title="Fib 50%", color=color.red, linewidth=1, style=plot.style_line) plot(fib_618, title="Fib 61.8%", color=color.green, linewidth=1, style=plot.style_line) plot(fib_100, title="Fib 100%", color=color.blue, linewidth=1, style=plot.style_line) // Create labels for Fibonacci levels with white text var label fibLabel0 = na var label fibLabel236 = na var label fibLabel382 = na var label fibLabel50 = na var label fibLabel618 = na var label fibLabel100 = na if (na(fibLabel0)) fibLabel0 := label.new(bar_index, fib_0, text="Fib 0%", color=na, textcolor=color.white, style=label.style_label_right, yloc=yloc.price) fibLabel236 := label.new(bar_index, fib_236, text="Fib 23.6%", color=na, textcolor=color.white, style=label.style_label_right, yloc=yloc.price) fibLabel382 := label.new(bar_index, fib_382, text="Fib 38.2%", color=na, textcolor=color.white, style=label.style_label_right, yloc=yloc.price) fibLabel50 := label.new(bar_index, fib_50, text="Fib 50%", color=na, textcolor=color.white, style=label.style_label_right, yloc=yloc.price) fibLabel618 := label.new(bar_index, fib_618, text="Fib 61.8%", color=na, textcolor=color.white, style=label.style_label_right, yloc=yloc.price) fibLabel100 := label.new(bar_index, fib_100, text="Fib 100%", color=na, textcolor=color.white, style=label.style_label_right, yloc=yloc.price) else label.set_xy(fibLabel0, bar_index, fib_0) label.set_xy(fibLabel236, bar_index, fib_236) label.set_xy(fibLabel382, bar_index, fib_382) label.set_xy(fibLabel50, bar_index, fib_50) label.set_xy(fibLabel618, bar_index, fib_618) label.set_xy(fibLabel100, bar_index, fib_100) // Plot signals plotshape(series=longSignal, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal", text="BUY") plotshape(series=shortSignal, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal", text="SELL") // Plot highest and lowest points plot(highestHigh, title="Highest High", color=color.purple, linewidth=2, offset=-lookback) plot(lowestLow, title="Lowest Low", color=color.purple, linewidth=2, offset=-lookback)