OPEN-SOURCE SCRIPT

Fibonacci Swing Trading Bot

Strategy Overview for "Fibonacci Swing Trading Bot"

Strategy Name: Fibonacci Swing Trading Bot
Version: Pine Script v5
Purpose: This strategy is designed for swing traders who want to leverage Fibonacci retracement levels and candlestick patterns to enter and exit trades on higher time frames.

Key Components:
1. Multiple Timeframe Analysis:
  • The strategy uses a customizable timeframe for analysis. You can choose between 4hour, daily, weekly, or monthly time frames to fit your preferred trading horizon. The high and low-price data is retrieved from the selected timeframe to identify swing points.


2. Fibonacci Retracement Levels:
  • The script calculates two key Fibonacci retracement levels:
  • 0.618: A common level where price often retraces before resuming its trend.
  • 0.786: A deeper retracement level, often used to identify stronger support/resistance areas.
  • These levels are dynamically plotted on the chart based on the highest high and lowest low over the last 50 bars of the selected timeframe.


3. Candlestick Based Entry Signals:
  • The strategy uses candlestick patterns as the only indicator for trade entries:
  • Bullish Candle: A green candle (close > open) that forms between the 0.618 retracement level and the swing high.
  • Bearish Candle: A red candle (close < open) that forms between the 0.786 retracement level and the swing low.
  • When these candlestick patterns align with the Fibonacci levels, the script triggers buy or sell signals.


4. Risk Management:
  • Stop Loss: The stop loss is set at 1% below the entry price for long trades and 1% above the entry price for short trades. This tight risk management ensures controlled losses.
  • Take Profit: The strategy uses a 2:1 risk-to-reward ratio. The take profit is automatically calculated based on this ratio relative to the stop loss.


5. Buy/Sell Logic:
  • Buy Signal: Triggered when a bullish candle forms above the 0.618 retracement level and below the swing high. The bot then places a long position.
  • Sell Signal: Triggered when a bearish candle forms below the 0.786 retracement level and above the swing low. The bot then places a short position.
  • The stop loss and take profit levels are automatically managed once the trade is placed.


Strengths of This Strategy:
  • Swing Trading Focus: The strategy is ideal for swing traders, targeting longer-term price moves that can take days or weeks to play out.
  • Simple Yet Effective Indicators: By only relying on Fibonacci retracement levels and basic candlestick patterns, the strategy avoids complexity while capitalizing on well-known support and resistance zones.
  • Automated Risk Management: The built-in stop loss and take profit mechanism ensures trades are protected, adhering to a strict 2:1 risk/reward ratio.
  • Multiple Timeframe Analysis: The script adapts to various market conditions by allowing users to switch between different timeframes (4hour, daily, weekly, monthly), giving traders flexibility.


Strategy Use Cases:
  • Retracement Traders: Traders who focus on entering the market at key retracement levels (0.618 and 0.786) will find this strategy especially useful.
  • Trend Reversal Traders: The strategy’s reliance on candlestick formations at Fibonacci levels helps traders spot potential reversals in price trends.
  • Risk Conscious Traders: With its 1% risk per trade and 2:1 risk/reward ratio, the strategy is ideal for traders who prioritize risk management in their trades.

Fibonacci ExtensionFibonacci RetracementfibonnaccimultitimeframeSupport and Resistanceswingtrading

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer