OPEN-SOURCE SCRIPT
Atualizado Efficiency Trailing Stop Loss

Efficiency TSL is an adaptive trailing stop framework designed to dynamically follow market movement while continuously adjusting stop behavior based on changing price efficiency and directional conditions.
Unlike traditional trailing stop systems that rely on static ATR values or fixed structure levels, Flip TSL evaluates how effectively price is moving and uses that information to expand, tighten, or aggressively reduce risk as market behavior evolves.
The objective is not simply to trail price, but to adapt risk management according to changing market conditions beneath the surface.
By combining market efficiency analysis, directional state detection, adaptive stop expansion logic, and automatic long/short transition behavior into a unified framework, the indicator is designed to provide additional context for trade management and evolving market structure.
Features
• Single adaptive trailing stop line
• Automatic Long ↔ Short transition system
• Dynamic stop expansion and tightening engine
• Market efficiency analysis
• Improvement / deterioration detection
• Automatic direction logic modes:
• Stop Cross
• SMA Direction
• Candle Direction
• Structure Step stop logic
• Swing High / Low fallback logic
• Multi-timeframe calculations
• Adjustable timeframe selection
• Wait-until-close confirmation option
• Dynamic ATR stop sizing
• Real-time dashboard
• Fully customizable colors and display settings
Dashboard Includes
• Current direction mode
• Auto direction method
• Efficiency score
• Market state
• Stop mode
• Active ATR multiplier
• Current trailing stop value
Alerts Included
• Flipped Long
• Flipped Short
• Efficiency crossed below threshold
• Long Mode Activated
• Short Mode Activated
Potential Use Cases
• Dynamically manage open positions
• Adapt stop placement to changing conditions
• Reduce risk during deteriorating environments
• Hold stronger trends longer
• Filter lower-quality market conditions
• Add confluence to existing systems
• Study changing market behavior
Interpretation
Expanded
Market efficiency is elevated and conditions remain supportive of directional continuation.
The trailing stop expands and provides additional room for price movement.
Tightening
Market conditions begin slowing or losing efficiency.
The trailing stop contracts and moves closer to price action.
Cut / Take Profit
Market efficiency falls beneath the defined threshold.
The stop may aggressively tighten or move toward current price to reduce exposure and protect gains.
Direction Modes
Stop Cross
Direction flips when price crosses the active trailing stop.
SMA Direction
Direction follows price relative to moving average positioning.
Candle Direction
Direction adapts based on bullish and bearish candle behavior.
About TrendGenY Indicators
TrendGenY indicators are built from market experience, creative concepts, and a constant pursuit of unique perspectives. Rather than following conventional ideas, the focus is on uncovering alternative insights and viewing market behavior through different angles to reveal information that traditional tools may overlook and help traders build a more meaningful edge in the market.
Unlike traditional trailing stop systems that rely on static ATR values or fixed structure levels, Flip TSL evaluates how effectively price is moving and uses that information to expand, tighten, or aggressively reduce risk as market behavior evolves.
The objective is not simply to trail price, but to adapt risk management according to changing market conditions beneath the surface.
By combining market efficiency analysis, directional state detection, adaptive stop expansion logic, and automatic long/short transition behavior into a unified framework, the indicator is designed to provide additional context for trade management and evolving market structure.
Features
• Single adaptive trailing stop line
• Automatic Long ↔ Short transition system
• Dynamic stop expansion and tightening engine
• Market efficiency analysis
• Improvement / deterioration detection
• Automatic direction logic modes:
• Stop Cross
• SMA Direction
• Candle Direction
• Structure Step stop logic
• Swing High / Low fallback logic
• Multi-timeframe calculations
• Adjustable timeframe selection
• Wait-until-close confirmation option
• Dynamic ATR stop sizing
• Real-time dashboard
• Fully customizable colors and display settings
Dashboard Includes
• Current direction mode
• Auto direction method
• Efficiency score
• Market state
• Stop mode
• Active ATR multiplier
• Current trailing stop value
Alerts Included
• Flipped Long
• Flipped Short
• Efficiency crossed below threshold
• Long Mode Activated
• Short Mode Activated
Potential Use Cases
• Dynamically manage open positions
• Adapt stop placement to changing conditions
• Reduce risk during deteriorating environments
• Hold stronger trends longer
• Filter lower-quality market conditions
• Add confluence to existing systems
• Study changing market behavior
Interpretation
Expanded
Market efficiency is elevated and conditions remain supportive of directional continuation.
The trailing stop expands and provides additional room for price movement.
Tightening
Market conditions begin slowing or losing efficiency.
The trailing stop contracts and moves closer to price action.
Cut / Take Profit
Market efficiency falls beneath the defined threshold.
The stop may aggressively tighten or move toward current price to reduce exposure and protect gains.
Direction Modes
Stop Cross
Direction flips when price crosses the active trailing stop.
SMA Direction
Direction follows price relative to moving average positioning.
Candle Direction
Direction adapts based on bullish and bearish candle behavior.
About TrendGenY Indicators
TrendGenY indicators are built from market experience, creative concepts, and a constant pursuit of unique perspectives. Rather than following conventional ideas, the focus is on uncovering alternative insights and viewing market behavior through different angles to reveal information that traditional tools may overlook and help traders build a more meaningful edge in the market.
Notas de Lançamento
New Features & Improvements:• Added Invert Efficiency Behavior option
Standard Mode:
Strong efficiency → wider stops
Weak efficiency → tighter stops
Inverted Mode:
Strong efficiency → tighter stops
Weak efficiency → wider stops
• Added selectable behavior toggle directly in settings
• Stop logic and dashboard now dynamically adapt based on selected behavior
• Added behavior status display to dashboard
• Improved stop state handling and transition logic
• Updated stop mode calculations for improved consistency
• Renamed Structure Step logic for improved clarity
This update adds additional flexibility for different trade management styles and market conditions.
Notas de Lançamento
Added AlertsScript de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.