OPEN-SOURCE SCRIPT
TLO Opening Box Retest Strategy

TLO Opening Box Retest Strategy is the backtestable strategy implementation of the TLO Opening Box Retest framework.
It evaluates a structured opening-range sequence:
BOX -> BREAK -> RETEST -> CONFIRMATION -> ENTRY -> EXIT
The strategy is intended to let traders evaluate the behavior of the setup historically using TradingView's Strategy Tester while keeping the visual sequence aligned with the companion TLO methodology.
CORE LOGIC
1. Opening Box
The strategy builds a high/low range from the configured opening hour.
2. First Breakout
After the opening box is complete, the strategy accepts only the first qualified directional breakout for that box.
3. First Retest
After the breakout, price must return to the breakout boundary within the configured retest window.
4. Confirmation
In Retest Confirmation mode, a long setup requires a retest of the upper boundary followed by a qualifying close back above the box.
A short setup requires a retest of the lower boundary followed by a qualifying close back below the box.
5. Entry
When the confirmation conditions are satisfied, the strategy submits the corresponding market entry.
TradingView normally executes market orders at the next available price under its strategy broker-emulator rules because Process Orders On Close is disabled.
ENTRY MODES
Retest Confirmation
This is the default mode.
The sequence is:
Breakout -> Retest -> Confirming close -> Entry
Direct Breakout
An optional mode allows entry on the initial qualified breakout without waiting for a retest.
RISK MANAGEMENT
The default strategy risk setting is approximately 0.50% of current strategy equity per trade.
Position size is calculated from:
- Current strategy equity
- Configured risk percentage
- Planned structural stop distance
- Instrument point value
Because an actual market-order fill can differ from the signal price, realized risk can differ from the requested percentage.
STOP
The default stop is positioned 2.0 opening-box heights from the breakout boundary.
This value is configurable.
EXIT MODES
Measured 1x Box
Default exit mode.
The target is projected one opening-box height beyond the breakout boundary.
Fixed R
A configurable multiple of the initial trade risk can be used instead.
Next Opening Box
The strategy can hold the position until a new opening box begins, subject to the active protective stop.
BREAKEVEN MANAGEMENT
By default, the strategy can move its protective stop to the actual entry price after price moves approximately +1R in the trade's favor.
AUTO SESSION MODE
US stocks, funds, and indices:
09:30-10:30 New York time
Forex and crypto:
Tokyo opening-hour template
Futures:
User-configurable futures opening hour
Custom session and timezone settings are also available.
OPTIONAL FILTERS
The default strategy does not require these filters, but users can enable:
30-minute EMA regime filter
Relative-volume breakout filter
They are optional because the strategy is designed so their incremental value can be evaluated separately rather than assumed.
DEFAULT STRATEGY SETTINGS
Entry mode:
Retest Confirmation
Breakout buffer:
0.00 ATR
Retest tolerance:
0.12 ATR
Maximum retest window:
80 chart bars
Confirmation close outside box:
Enabled
Approximate risk:
0.50% of strategy equity
Stop:
2.0 box heights
Exit:
Measured 1x Box
Measured target:
1.0 box height
Move stop to breakeven:
Enabled after approximately +1R
30-minute regime filter:
Disabled
RVOL filter:
Disabled
Pyramiding:
0
Process orders on close:
Disabled
Recalculate after order fills:
Enabled
Recalculate on every tick:
Disabled
Bar Magnifier:
Enabled
Commission:
0.01%
BACKTEST INTERPRETATION
The published strategy report is a simulation generated by TradingView's broker emulator. It is not a live trading record.
Bar Magnifier is enabled to improve intrabar order simulation where lower-timeframe historical data is available, but the simulation cannot reproduce every real-world execution condition.
Actual results can differ because of:
- Bid/ask spreads
- Slippage
- Gaps
- Liquidity
- Order latency
- Exchange behavior
- Broker execution
- Different market sessions
- Data-feed differences
The strategy does not use future price information to create entries.
Historical profitability, win rate, drawdown, or other Strategy Tester statistics do not predict future performance.
ORIGINAL TLO FUNCTIONALITY
Breakout/retest trading is a widely known technical-analysis concept.
The TLO implementation adds a coordinated deterministic framework including:
- Automatic session adaptation by instrument type
- First-break locking
- First-retest locking
- One trade sequence per opening box
- Configurable structural exits
- Risk-based position sizing
- Optional breakeven management
- Optional regime filtering
- Optional participation filtering
- Historical-session visualization
- Clean state-controlled presentation
The source code is restricted because the TLO-specific state machine, session adaptation, risk architecture, and implementation details are part of the TLO system.
LIMITATIONS
This strategy is a research and decision-support implementation.
It does not guarantee profitable trades or future performance.
The session definition and execution settings should be reviewed for every instrument before relying on the results.
Signals vary by chart timeframe.
Use standard candlestick charts. Strategy reports created using synthetic/non-standard bars can produce unrealistic execution results.
Traders remain responsible for validating the strategy for their own market, broker, costs, position sizing, and risk tolerance.
It evaluates a structured opening-range sequence:
BOX -> BREAK -> RETEST -> CONFIRMATION -> ENTRY -> EXIT
The strategy is intended to let traders evaluate the behavior of the setup historically using TradingView's Strategy Tester while keeping the visual sequence aligned with the companion TLO methodology.
CORE LOGIC
1. Opening Box
The strategy builds a high/low range from the configured opening hour.
2. First Breakout
After the opening box is complete, the strategy accepts only the first qualified directional breakout for that box.
3. First Retest
After the breakout, price must return to the breakout boundary within the configured retest window.
4. Confirmation
In Retest Confirmation mode, a long setup requires a retest of the upper boundary followed by a qualifying close back above the box.
A short setup requires a retest of the lower boundary followed by a qualifying close back below the box.
5. Entry
When the confirmation conditions are satisfied, the strategy submits the corresponding market entry.
TradingView normally executes market orders at the next available price under its strategy broker-emulator rules because Process Orders On Close is disabled.
ENTRY MODES
Retest Confirmation
This is the default mode.
The sequence is:
Breakout -> Retest -> Confirming close -> Entry
Direct Breakout
An optional mode allows entry on the initial qualified breakout without waiting for a retest.
RISK MANAGEMENT
The default strategy risk setting is approximately 0.50% of current strategy equity per trade.
Position size is calculated from:
- Current strategy equity
- Configured risk percentage
- Planned structural stop distance
- Instrument point value
Because an actual market-order fill can differ from the signal price, realized risk can differ from the requested percentage.
STOP
The default stop is positioned 2.0 opening-box heights from the breakout boundary.
This value is configurable.
EXIT MODES
Measured 1x Box
Default exit mode.
The target is projected one opening-box height beyond the breakout boundary.
Fixed R
A configurable multiple of the initial trade risk can be used instead.
Next Opening Box
The strategy can hold the position until a new opening box begins, subject to the active protective stop.
BREAKEVEN MANAGEMENT
By default, the strategy can move its protective stop to the actual entry price after price moves approximately +1R in the trade's favor.
AUTO SESSION MODE
US stocks, funds, and indices:
09:30-10:30 New York time
Forex and crypto:
Tokyo opening-hour template
Futures:
User-configurable futures opening hour
Custom session and timezone settings are also available.
OPTIONAL FILTERS
The default strategy does not require these filters, but users can enable:
30-minute EMA regime filter
Relative-volume breakout filter
They are optional because the strategy is designed so their incremental value can be evaluated separately rather than assumed.
DEFAULT STRATEGY SETTINGS
Entry mode:
Retest Confirmation
Breakout buffer:
0.00 ATR
Retest tolerance:
0.12 ATR
Maximum retest window:
80 chart bars
Confirmation close outside box:
Enabled
Approximate risk:
0.50% of strategy equity
Stop:
2.0 box heights
Exit:
Measured 1x Box
Measured target:
1.0 box height
Move stop to breakeven:
Enabled after approximately +1R
30-minute regime filter:
Disabled
RVOL filter:
Disabled
Pyramiding:
0
Process orders on close:
Disabled
Recalculate after order fills:
Enabled
Recalculate on every tick:
Disabled
Bar Magnifier:
Enabled
Commission:
0.01%
BACKTEST INTERPRETATION
The published strategy report is a simulation generated by TradingView's broker emulator. It is not a live trading record.
Bar Magnifier is enabled to improve intrabar order simulation where lower-timeframe historical data is available, but the simulation cannot reproduce every real-world execution condition.
Actual results can differ because of:
- Bid/ask spreads
- Slippage
- Gaps
- Liquidity
- Order latency
- Exchange behavior
- Broker execution
- Different market sessions
- Data-feed differences
The strategy does not use future price information to create entries.
Historical profitability, win rate, drawdown, or other Strategy Tester statistics do not predict future performance.
ORIGINAL TLO FUNCTIONALITY
Breakout/retest trading is a widely known technical-analysis concept.
The TLO implementation adds a coordinated deterministic framework including:
- Automatic session adaptation by instrument type
- First-break locking
- First-retest locking
- One trade sequence per opening box
- Configurable structural exits
- Risk-based position sizing
- Optional breakeven management
- Optional regime filtering
- Optional participation filtering
- Historical-session visualization
- Clean state-controlled presentation
The source code is restricted because the TLO-specific state machine, session adaptation, risk architecture, and implementation details are part of the TLO system.
LIMITATIONS
This strategy is a research and decision-support implementation.
It does not guarantee profitable trades or future performance.
The session definition and execution settings should be reviewed for every instrument before relying on the results.
Signals vary by chart timeframe.
Use standard candlestick charts. Strategy reports created using synthetic/non-standard bars can produce unrealistic execution results.
Traders remain responsible for validating the strategy for their own market, broker, costs, position sizing, and risk tolerance.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
TLO Markets | Evidence-driven trading tools, multi-timeframe market intelligence, quantitative research and Pine Script. Research first. Evidence over hype.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
TLO Markets | Evidence-driven trading tools, multi-timeframe market intelligence, quantitative research and Pine Script. Research first. Evidence over hype.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.