OPEN-SOURCE SCRIPT

Fibonacci Trend Reversal Strategy

Updated
Introduction
This publication introduces the "Fibonacci Retracement Trend Reversal Strategy," tailored for traders aiming to leverage shifts in market momentum through advanced trend analysis and risk management techniques. This strategy is designed to pinpoint potential reversal points, optimizing trading opportunities.

Overview
The strategy leverages Fibonacci retracement levels derived from IMBA_TRADER's [Imba]lance Algo to identify potential trend reversals. It's further enhanced by a method called "Trend Strength Over Time" (TSOT) (by federalTacos5392b), which utilizes percentile rankings of price action to measure trend strength. This also has implemented Dynamic SL finder by utilizing veryfid's ATR Stoploss Finder which works pretty well

Indicators:
  1. Fibonacci Retracement Levels: Identifies critical reversal zones at 23.6%, 50%, and 78.6% levels.
  2. TSOT (Trend Strength Over Time): Employs percentile rankings across various timeframes to gauge the strength and direction of trends, aiding in the confirmation of Fibonacci-based signals.
  3. ATR (Average True Range): Implements dynamic stop-loss settings for both long and short positions, enhancing trade security.


Strategy Settings:
- Sensitivity: Set default at 18, adjustable for more frequent or sparse signals based on market volatility.
- ATR Stop Loss Finder: Multiplier set at 3.5, applying the ATR value to determine stop losses dynamically.
- ATR Length: Default set to 14 with RMA smoothing.
- TSOT Settings: Hard-coded to identify percentile ranks, with no user-adjustable inputs due to its intrinsic calculation method.

Trade Direction Options: Configurable to support long, short, or both directions, adaptable to the trader's market assessment.

Entry Conditions:
- Long Entry: Triggered when the price surpasses the mid Fibonacci level (50%) with a bullish TSOT signal.
- Short Entry: Activated when the price falls below the mid Fibonacci level with a bearish TSOT indication.

Exit Conditions:
- Employs ATR-based dynamic stop losses, calibrated according to current market volatility, ensuring effective risk management.

Strategy Execution:
- Risk Management: Features adjustable risk-reward settings and enables partial take profits by default to systematically secure gains.
- Position Reversal: Includes an option to reverse positions based on new TSOT signals, improving the strategy's responsiveness to evolving market conditions.

The strategy is optimized for the WIFUSDT.P market on a scalping (5-minute) timeframe, using the default settings outlined above.

I spent a lot of time creating the dynamic exit strategies for partially taking profits and reversing positions so please make use of those and feel free to adjust the settings, tool tips are also provided.

For Developers: this is published as open-sourced code so that developers can learn something especially on dynamic exits and partial take profits!

Good Luck!

Disclaimer
This strategy is shared for educational purposes and must be thoroughly tested under diverse market conditions. Past performance does not guarantee future results. Traders are advised to integrate this strategy with other analytical tools and tailor it to specific market scenarios. I was only sharing what I've crafted while strategizing over a Solana Meme Coin.
Release Notes
Change Notes:
  • Added credits to the open source code

  • Added pretty visual fills for the dynamic strategy on SLs and TPs so it can easily be tracked


Note you can allways turn the visuals on or off from the style tab/section of the indicator

For a clean chart, I recommend turning the ATR Long stop Loss and ATR Short Stop Loss to OFF since it's already plotted by the entry visuals, but for refrence you can always turn it back on.

Also, feel free to customize the colors, lines, background, to your preference.
Release Notes
Updates:
  • Enhanced default ATR SL colors

  • Fixed BG and Plots of Entries
Release Notes
Update Notes:
  • It now does execute TP 1 and TP 2 for partial take profits


Unfortunately, Pinescript is a still bit buggy and limited when handling stoploss and adjusting stoploss for it to b executed at market order and we will still keep the closing of SL and Break Evens with our current method, (at least our TPs are now securely exiting exacly)
Release Notes
Some enhancements.

Steps to link this to bybit via webhook to automate execution of orders.

Prerequisites:
1. Bybit Unified Trading Account funds
2. Paid Tradingview plan (for webhook enabling)
3. Pair is both available in Derivatives/Futures on bybit and Tradingview

Bybit Setup:
1. Go to Derivatives > USDT Perpetual > Select your pair (eg. SOL/USDT) > Set your preferred Leverage
2. Tools > Strategy Trading > Webhook Signal Trading > Create Now
3. Click Confirm > Verify your pair > Create a name (anything would do) > Next > Create
4. Bybit will show you your message template and webhook url, keep this for later use.
Stay on this page for now, since we will proceed setup in Tradingview and copy over the values given to us by ByBit

Tradingview Setup:
1. Add this indicator strategy > adjust it's values to your preference
2. Set the strategy settings > Properties > Ordersize > Input the desired number of contracts you want the bot to execute per trade (taking into account the leverage)

Connecting the triggers with bybit:
1. Create an alert on tradingview > Set Condition to be this strategy > set a name and expiration
2. Copy and paste the message from ByBit to this alert (replace everything and dont change anything)
3. Select Notifications Tab > Enable Webhook URL > Paste Webhook URL given by ByBit
4. click Create
5. Go to Bybit > Click Run Webhook

Monitor and adjust! Some failing order may occur, you can monitor this under tools tab in Bybit.


Average True Range (ATR)educationalforecasting

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