Daily Breakout + Daily Shadow By Rouro

Daily Data Retrieval
Using request.security(..., "D", ...) it fetches the OHLC and timestamp of the daily candle, regardless of the chart’s current timeframe.
Calculation of Yesterday’s and Day-Before-Yesterday’s Bodies
b1High and b1Low → the high/low of yesterday’s daily candle body
b2High and b2Low → the high/low of the previous day’s body
Detection of the First Intraday Bar After a New Day
By using ta.change(time("D")), it marks the start of each new trading day.
Drawing the Previous Day’s “Shadow” on the Chart
It overlays a box (box.new) and two wick lines (line.new) with configurable colors and transparency, so you can clearly see the full range of yesterday’s candle on any intraday chart.
Automatic End-of-Day Position Closure
It will automatically close any open position at the start of the next day to avoid unintended rollovers.
Entry Signals
On the very first intraday bar after the daily close:
Long if yesterday’s close broke above the body of the day before yesterday
Short if yesterday’s close broke below the body of the day before yesterday
…which triggers a strategy.entry at the intraday open.
Fully Customizable Stop-Loss and Take-Profit
SL options:
Opposite end of yesterday’s body
Fixed pips from entry
A risk-reward ratio on yesterday’s wick
Optional “safety SL” in fixed pips that overrides the above
TP options:
Fixed pips
Yesterday’s wick extreme (high/low)
Partial exit on the wick (TP1), then second exit (TP2) either:
At a multiplied RR
Or at the daily close (“Close of Day”)
You can also choose to move SL to breakeven after TP1 is hit.
Live Metrics Table
In the upper-right corner it displays in real time:
Start of backtest (date of first trade)
Number of ✅ Winning trades and ❌ Losing trades
Total number of trades
Win rate (%)
Profit Factor
All within a fixed table layout so it never runs out of rows or columns.
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.
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.