OPEN-SOURCE SCRIPT

Daily Breakout + Daily Shadow By Rouro

751
This script is a Pine v5 strategy designed to detect daily candle body breakouts and execute them on any intraday timeframe, while also providing:

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.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.