OPEN-SOURCE SCRIPT
Btcusdt Dual-Engine Trend Strategy

This strategy was built and tuned primarily for BINANCE:BTCUSDT on the 1D chart.
It is a long-only dual-engine trend-following strategy. The script combines a trend/regime layer with a breakout-and-risk engine, then manages positions through ATR-based initial risk, adaptive trailing protection, and optional regime-aware exits.
How it works
The first layer is the regime engine. The script can run with the regime filter disabled, with a stricter EMA-based regime filter, or with a lighter mode. When enabled, the regime logic evaluates price location versus the regime EMA, optional EMA slope direction, optional ADX confirmation, and a softer scoring model based on distance from EMA, slope, range position, and reclaim behavior. This allows the strategy to separate stronger trend conditions from weaker or less reliable ones.
The second layer is the entry engine. The script can enter through several conditions:
1) breakout continuation above a prior high range,
2) pullback recovery after weakness below a faster EMA,
3) soft-regime reclaim entries when the softer regime model is constructive even if the stricter regime is not fully confirmed,
4) a capped reclaim setup below the fixed EMA200 reference.
Entries are placed as stop-style orders, so the strategy reacts when price actually reaches the trigger level rather than assuming a simple bar-close fill. This makes the script more sensitive to intrabar movement than close-only strategies.
Risk and position sizing
The script includes multiple position control layers. Exposure can be reduced automatically as strategy drawdown increases. Optional volatility targeting can adjust effective leverage using ATR%. Position size can also be capped by a stop-distance-based risk limit, while max exposure and fee reserve settings help keep sizing within defined limits.
Exit logic
Open positions are managed with an ATR-based initial stop and a monotonic trailing stop that tightens after sufficient favorable excursion. An optional breakeven rule can move protection to entry after a defined profit threshold. After a minimum holding period, the strategy can also use a Donchian-style exit. If regime exits are enabled, the script can additionally tighten or force exits when regime conditions deteriorate.
How to use
Start on BINANCE:BTCUSDT 1D with the default script settings before changing anything.
First calibrate trading costs and execution assumptions.
Then adjust exposure and risk controls.
Only after that should you tune signal-speed parameters such as breakout length, exit length, and trailing settings.
Inputs that matter most
commission_value
Use this to approximate your actual fee level.
slippage
Use this to approximate execution friction. If live fills are worse than TradingView fills, adjust this before touching the signal logic.
regimeMode, useSoftRegime, requireSlope
These define how strict the regime filter is and whether the script can use softer trend qualification.
useAdxFilter, adxMin
These reduce participation when trend strength is weak.
useAtrGuard, atrPctGuard
These can block entries during unstable volatility conditions.
ddStart, ddEnd, ddMinScale
These reduce exposure during equity drawdowns.
useVolTarget, volTargetPct, volMinLev, volMaxLev
These define the optional volatility-targeting layer.
maxExposurePct, entryPct, feeReservePct, useRiskCap, riskCapPct
These are the main capital allocation and position-risk controls.
entryLen, exitLen, addLen, pullbackPct, breakBufPct
These define the entry and exit speed and how the strategy reacts to breakout versus pullback recovery conditions.
initStopATR, trailBase, trailTight, tightenAtR, useBE, beR, minHoldBars
These define the protection and trailing behavior after entry.
Important notes
This is not a low-volatility or low-turnover script. It can still experience meaningful drawdowns, especially when trend persistence breaks down or execution quality is worse than assumed.
TradingView results may differ from live execution because of fees, slippage, intrabar behavior, data revisions, exchange-specific matching, and alert-to-execution differences.
The strategy includes some generic market-structure inputs such as daily limit handling and offline cost placeholders. For BTCUSDT, users should review whether those settings are relevant to their own venue before relying on results.
This script is provided for research and educational use only. It is not investment advice.
It is a long-only dual-engine trend-following strategy. The script combines a trend/regime layer with a breakout-and-risk engine, then manages positions through ATR-based initial risk, adaptive trailing protection, and optional regime-aware exits.
How it works
The first layer is the regime engine. The script can run with the regime filter disabled, with a stricter EMA-based regime filter, or with a lighter mode. When enabled, the regime logic evaluates price location versus the regime EMA, optional EMA slope direction, optional ADX confirmation, and a softer scoring model based on distance from EMA, slope, range position, and reclaim behavior. This allows the strategy to separate stronger trend conditions from weaker or less reliable ones.
The second layer is the entry engine. The script can enter through several conditions:
1) breakout continuation above a prior high range,
2) pullback recovery after weakness below a faster EMA,
3) soft-regime reclaim entries when the softer regime model is constructive even if the stricter regime is not fully confirmed,
4) a capped reclaim setup below the fixed EMA200 reference.
Entries are placed as stop-style orders, so the strategy reacts when price actually reaches the trigger level rather than assuming a simple bar-close fill. This makes the script more sensitive to intrabar movement than close-only strategies.
Risk and position sizing
The script includes multiple position control layers. Exposure can be reduced automatically as strategy drawdown increases. Optional volatility targeting can adjust effective leverage using ATR%. Position size can also be capped by a stop-distance-based risk limit, while max exposure and fee reserve settings help keep sizing within defined limits.
Exit logic
Open positions are managed with an ATR-based initial stop and a monotonic trailing stop that tightens after sufficient favorable excursion. An optional breakeven rule can move protection to entry after a defined profit threshold. After a minimum holding period, the strategy can also use a Donchian-style exit. If regime exits are enabled, the script can additionally tighten or force exits when regime conditions deteriorate.
How to use
Start on BINANCE:BTCUSDT 1D with the default script settings before changing anything.
First calibrate trading costs and execution assumptions.
Then adjust exposure and risk controls.
Only after that should you tune signal-speed parameters such as breakout length, exit length, and trailing settings.
Inputs that matter most
commission_value
Use this to approximate your actual fee level.
slippage
Use this to approximate execution friction. If live fills are worse than TradingView fills, adjust this before touching the signal logic.
regimeMode, useSoftRegime, requireSlope
These define how strict the regime filter is and whether the script can use softer trend qualification.
useAdxFilter, adxMin
These reduce participation when trend strength is weak.
useAtrGuard, atrPctGuard
These can block entries during unstable volatility conditions.
ddStart, ddEnd, ddMinScale
These reduce exposure during equity drawdowns.
useVolTarget, volTargetPct, volMinLev, volMaxLev
These define the optional volatility-targeting layer.
maxExposurePct, entryPct, feeReservePct, useRiskCap, riskCapPct
These are the main capital allocation and position-risk controls.
entryLen, exitLen, addLen, pullbackPct, breakBufPct
These define the entry and exit speed and how the strategy reacts to breakout versus pullback recovery conditions.
initStopATR, trailBase, trailTight, tightenAtR, useBE, beR, minHoldBars
These define the protection and trailing behavior after entry.
Important notes
This is not a low-volatility or low-turnover script. It can still experience meaningful drawdowns, especially when trend persistence breaks down or execution quality is worse than assumed.
TradingView results may differ from live execution because of fees, slippage, intrabar behavior, data revisions, exchange-specific matching, and alert-to-execution differences.
The strategy includes some generic market-structure inputs such as daily limit handling and offline cost placeholders. For BTCUSDT, users should review whether those settings are relevant to their own venue before relying on results.
This script is provided for research and educational use only. It is not investment advice.
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.
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.