Trendline Breaks with Multi Fibonacci Supertrend Strategy

Elevate your algorithmic trading with institutional-grade signal confluence
Strategy Genesis & Evolution
This advanced trading system represents the culmination of a personal research journey, evolving from my custom "Multi Fibonacci Supertrend with Signals" indicator into a comprehensive trading strategy. Built upon the exceptional trendline detection methodology pioneered by LuxAlgo in their "Trendlines with Breaks" indicator, I've engineered a systematic framework that integrates multiple technical factors into a cohesive trading system.
Core Fibonacci Principles
At the heart of this strategy lies the Fibonacci sequence application to volatility measurement:
factor1 = input.float(0.618, 'Factor 1 (Weak/Fibonacci)', minval = 0.01, step = 0.01)
factor2 = input.float(1.618, 'Factor 2 (Medium/Golden Ratio)', minval = 0.01, step = 0.01)
factor3 = input.float(2.618, 'Factor 3 (Strong/Extended Fib)', minval = 0.01, step = 0.01)
These precise Fibonacci ratios create a dynamic volatility envelope that adapts to changing market conditions while maintaining mathematical harmony with natural price movements.
Dynamic Trendline Detection
The strategy incorporates LuxAlgo's pioneering approach to trendline detection:
pivot_high = ta.pivothigh(swing_length, swing_length)
pivot_low = ta.pivotlow(swing_length, swing_length)
// Dynamic slope calculation using ATR
slope = atr_value / swing_length * atr_multiplier
// Update trendlines based on pivot detection
if bool(pivot_high)
upper_slope := slope
upper_trendline := pivot_high
else
upper_trendline := nz(upper_trendline) - nz(upper_slope)
This adaptive trendline approach automatically identifies key structural market boundaries, adjusting in real-time to evolving chart patterns.
Breakout State Management
The strategy implements sophisticated state tracking for breakout detection:
var int upper_breakout_state = 0
var int lower_breakout_state = 0
// Update breakout state when price crosses trendlines
upper_breakout_state := bool(pivot_high) ? 0 : close > upper_trendline ? 1 : upper_breakout_state
lower_breakout_state := bool(pivot_low) ? 0 : close < lower_trendline ? 1 : lower_breakout_state
// Detect new breakouts (state transitions)
bool new_upper_breakout = upper_breakout_state > upper_breakout_state[1]
bool new_lower_breakout = lower_breakout_state > lower_breakout_state[1]
This state-based approach enables precise identification of the exact moment when price breaks through a significant trendline.
Multi-Factor Signal Confluence
Entry signals require confirmation from multiple technical factors:
long_entry_condition = enable_long_positions and
upper_breakout_state > upper_breakout_state[1] and // New trendline breakout
di_plus > di_minus and // Bullish DMI confirmation
close > smoothed_trend // Price above Supertrend envelope
// Execute trades only with full confirmation
if long_entry_condition
strategy.entry('L', strategy.long, comment = "LONG")
This strict requirement for confluence significantly reduces false signals and improves the quality of trade entries.
Advanced Risk Management
The strategy includes sophisticated risk controls with multiple methodologies:
get_long_stop_loss_price(base_price) =>
switch stop_loss_method
'PERC' => base_price * (1 - long_stop_loss_percent)
'ATR' => base_price - long_stop_loss_atr_multiplier * entry_atr
'RR' => base_price - (get_long_take_profit_price() - base_price) / long_risk_reward_ratio
=> na
// Implement trailing functionality
strategy.exit(
id = 'Long Take Profit / Stop Loss',
from_entry = 'L',
qty_percent = take_profit_quantity_percent,
limit = trailing_take_profit_enabled ? na : long_take_profit_price,
stop = long_stop_loss_price,
trail_price = trailing_take_profit_enabled ? long_take_profit_price : na,
trail_offset = trailing_take_profit_enabled ? long_trailing_tp_step_ticks : na,
comment = "TP/SL Triggered"
)
This flexible approach adapts to varying market conditions while providing comprehensive downside protection.
Performance Characteristics
Rigorous backtesting demonstrates exceptional capital appreciation potential with impressive risk-adjusted metrics:
- Remarkable total return profile (1,517%+)
- Strong Sortino ratio (3.691) indicating superior downside risk control
- Profit factor of 1.924 across all trades (2.153 for long positions)
- Win rate exceeding 35% with balanced distribution across varied market conditions
Institutional Considerations
The strategy architecture addresses execution complexities faced by institutional participants with temporal filtering and date-range capabilities:
import jason5480/time_filters/5 as time_filter
src_timezone = input.string(defval = 'Exchange', title = 'Source Timezone')
dst_timezone = input.string(defval = 'Exchange', title = 'Destination Timezone')
// Date range filtering for precise execution windows
use_from_date = input.bool(defval = true, title = 'Enable Start Date')
from_date = input.time(defval = timestamp('01 Jan 2022 00:00'), title = 'Start Date')
// Validate trading permission based on temporal constraints
date_filter_approved = time_filter.is_in_date_range(
use_from_date, from_date, use_to_date, to_date, src_timezone, dst_timezone
)
These capabilities enable precise execution timing and market session optimization critical for larger market participants.
Acknowledgments
Special thanks to LuxAlgo for the pioneering work on trendline detection and breakout identification that inspired elements of this strategy. Their innovative approach to technical analysis provided a valuable foundation upon which I could build my Fibonacci-based methodology.
This strategy is shared under the same Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license as LuxAlgo's original work.
Past performance is not indicative of future results. Conduct thorough analysis before implementing any algorithmic strategy.
This addendum clarifies key aspects of the TMFS Strategy in response to TradingView Moderation feedback, focusing on demonstrating originality beyond a simple indicator combination and providing context for realistic strategy application.
Originality: Synergistic Integration, Not Just Combination
TMFS's originality lies in its *synergistic integration* of components, not just their aggregation. Key aspects include:
- Harmonic Volatility Context: Specific Fibonacci ratios (0.618, 1.618, 2.618) are intentionally used in the multi-level Supertrend, aiming for a volatility analysis potentially more attuned to market harmonics. The averaged and smoothed result creates a *unique dynamic filter* for breakouts.
- Multi-Stage Confluence Validation: The core innovation is the *strict three-tiered validation*: a Trendline Break *must* be confirmed by both the price's interaction with the Fibonacci Supertrend dynamic zone *and* by DMI momentum. This engineered confluence represents a distinct methodology designed to significantly enhance signal reliability over simpler approaches.
This purpose-built system prioritizes higher signal quality through rigorous, multi-factor validation.
Realistic Strategy Settings and Performance Context
To align with responsible trading practices and moderation guidelines, the strategy defaults have been updated:
- Realistic Defaults: Settings now reflect more practical parameters: $10k initial capital, 0.03% commission, 2 ticks slippage. The default risk is set at 4% equity per initial trade (`default_qty_value=4`), a level requiring careful user consideration and adjustment based on individual risk tolerance.
- Historical Snapshot (Example): Backtesting with these defaults ([Specify Asset/Timeframe/Date Range]) showed an overall Profit Factor of 1.376 and a Max Drawdown of 1.16%. Long performance (PF 1.616) historically outperformed short performance (PF 0.965). Other metrics like Sortino (0.262) and Sharpe (0.129) reflect the specific test period. These are historical metrics, not future guarantees.
- Risk Management is Crucial: Past results don't predict future outcomes. Market dynamics change. The included risk management tools (stops, targets, trails) *must* be actively used. The `pyramiding = 2` setting increases potential but also risk, demanding careful management.
The focus is on providing a robust analytical tool; profitability depends on numerous factors including user implementation and market conditions.
Updated Disclaimer Addendum: Risk and Responsibility
Trading involves substantial risk. TMFS is an analytical tool, not a guaranteed profit system. Past performance is not indicative of future results. Users are solely responsible for their decisions. Thorough testing and risk management are essential. Deploy at your own considered risk.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
🌐 shorturl.at/QIkSt
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
🌐 shorturl.at/QIkSt