OPEN-SOURCE SCRIPT

Day Range Breakout Strategy + Trend Structure Filter

197
🚀 Enhanced Strategy for Breaking Previous Day’s Extremes with Market Structure-Based Trend

The strategy focuses on breakouts of previous day’s highs and lows, filtered by trend direction based on market structure.

🔑 Key Improvements

1️⃣ Solved the repainting issue.
There are similar strategies in the community, but the historical results of those algorithms do not correspond to the results of real backtesting.

2️⃣ Added a trend filter.
In most cases, this makes it possible to achieve higher profitability. It works as follows:

The script determines market structure based on a defined number of previous candles.

If there are higher highs and higher lows, this is considered an uptrend structure.

If there are lower highs and lower lows, this is considered a downtrend structure.

The trend filter is adjusted using the Lookback Period setting.

3️⃣ Choice of entry principle.
Implemented the ability to choose whether trades are opened based on closing prices or by high/low breakout, which allows finding the optimal settings for a specific instrument.

4️⃣ Improved entry/exit logic.
When an opposite signal appears, before entering a trade, the script first closes the previous position.
✅ This makes the strategy fully ready for algorithmic trading via webhook on any exchange that supports this function.

5️⃣ Better visualization.
🟥 Red and 🟩 green backgrounds indicate the trend direction.

⚙️ How It Works

The principle of the strategy as follows:

Wait for the breakout of the previous day’s high or low.

Enter long on a breakout of the high, or short on a breakout of the low in the market structure trend direction.

Exit occurs on the breakout of the opposite extreme.

📈 This allows capturing long trends.
⚠️ But, like all similar strategies, in a sideways market it produces losing trades.

⚙️ Default Settings

Breakout Confirmation:
The breakout is determined by the candle close.
You can also choose high/low, but this often gives more false signals. However, on some assets, it may show higher profitability in backtesting.

Trend Structure Period:
The default value is 15.
This means the script analyzes the last 15 candles on the selected timeframe to determine market structure as described above.

Position Size:
Fixed at $1,000, which is 1% of the initial capital of $100,000 to keep risks under control.

Commission:
Set to 0.1%, which is sufficient for most cryptocurrency exchanges.

Slippage:
Configured at 1 tick.

Funding Note:
Keep in mind that funding is not included in this strategy.
It’s impossible to predict whether it will be positive or negative, and it can vary significantly across exchanges, so it is not part of the default settings.

🕒 Recommended Settings

Timeframe: 1H and higher

On lower timeframes → significant discrepancies may occur between historical and real backtesting data.

On higher timeframes → minor differences are possible, related to slippage, sharp moves, and other unpredictable situations.

⚠️ Important Notes

Always remember: Strategy results may not repeat in the future.

The market constantly changes, so:
✅ Monitor the situation
✅ Backtest regularly
✅ Adjust settings for each asset

Also remember about possible bugs in any algorithmic trading strategy.
Even if a script is well-tested, no one knows what unpredictable events the market may bring tomorrow.

⚠️ Risk Management:
Do not risk more than 1% of your deposit per trade, otherwise you may lose your account balance, since this strategy works without stop losses.

⚠️ Disclaimer

The author of the strategy does not encourage anyone to use this algorithm and bears no responsibility for any possible financial losses resulting from its application!

Any decision to use this strategy is made personally by the owners of TradingView accounts and cryptocurrency exchange accounts.

📝 Final Notes

This is not the final version. I already have ideas on how to improve it further, so follow me to not miss updates.

🐞 Bug Reports

If you notice any bugs or inconsistencies in my algorithm,
please let me know — I will try to fix them as quickly as possible.

💬 Feedback & Suggestions

If you have any ideas on how this or any of my other strategies can be improved, feel free to write to me. I will try to implement your suggestions in the script.

Wishing everyone good luck and stable profits! 🚀💰

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.