OPEN-SOURCE SCRIPT
Undertow Backtest

STRATEGY — UNDERTOW BACKTEST [UNDR BT]

SHORT SUMMARY
The backtest engine for Undertow. Simulate the buy/sell dots across any asset and timeframe, and choose whether to trade only the strong signals or every crossover.
WHAT IT IS
Undertow Backtest is the strategy version of the Undertow indicator. It applies Undertow's buy and sell logic to historical data and reports how a simple long-only approach would have performed — net profit, win rate, drawdown, and a full trade list — in TradingView's Strategy Tester.
HOW IT WORKS
— Entry (long): on an Undertow buy signal
— Exit: on an Undertow sell signal
— You independently choose, via dropdowns, whether buys fire on strong dots only (crosses beyond the oversold bound) or on all dots (every upward cross), and likewise for sells.
This lets you compare four behaviors: patient (strong/strong), active (all/all), aggressive long-bias (all buys / strong sells), and defensive (strong buys / all sells).
SETTINGS
— All the same WaveTrend and threshold inputs as the indicator
— Buy On: Strong dots only / All dots
— Sell On: Strong dots only / All dots
— Default starting capital, position sizing, and commission are set in the strategy properties and can be edited
IMPORTANT LIMITATIONS — PLEASE READ
— The backtest fills orders at bar close and does NOT model slippage; real-world results would typically be worse.
— It is long-only and goes effectively all-in per signal by default; this is a simplification, not a recommended position-sizing method.
— Higher timeframes (weekly, monthly) produce few trades, which is too small a sample to draw firm conclusions from. Test across multiple assets and timeframes.
— Optimizing the settings until the backtest looks great ("curve fitting") usually produces results that fall apart on live data. Prefer settings that are robust across many markets over ones that are perfect on one.
CREDITS & BASIS
Based on the open-source WaveTrend Oscillator concept (LazyBear) plus a standard RSI. Published open-source.
DISCLAIMER
For educational purposes only. Not financial advice. Backtested performance is hypothetical and does not represent actual trading. No system guarantees future profits. Trade at your own risk and never risk more than you can afford to lose.
SHORT SUMMARY
The backtest engine for Undertow. Simulate the buy/sell dots across any asset and timeframe, and choose whether to trade only the strong signals or every crossover.
WHAT IT IS
Undertow Backtest is the strategy version of the Undertow indicator. It applies Undertow's buy and sell logic to historical data and reports how a simple long-only approach would have performed — net profit, win rate, drawdown, and a full trade list — in TradingView's Strategy Tester.
HOW IT WORKS
— Entry (long): on an Undertow buy signal
— Exit: on an Undertow sell signal
— You independently choose, via dropdowns, whether buys fire on strong dots only (crosses beyond the oversold bound) or on all dots (every upward cross), and likewise for sells.
This lets you compare four behaviors: patient (strong/strong), active (all/all), aggressive long-bias (all buys / strong sells), and defensive (strong buys / all sells).
SETTINGS
— All the same WaveTrend and threshold inputs as the indicator
— Buy On: Strong dots only / All dots
— Sell On: Strong dots only / All dots
— Default starting capital, position sizing, and commission are set in the strategy properties and can be edited
IMPORTANT LIMITATIONS — PLEASE READ
— The backtest fills orders at bar close and does NOT model slippage; real-world results would typically be worse.
— It is long-only and goes effectively all-in per signal by default; this is a simplification, not a recommended position-sizing method.
— Higher timeframes (weekly, monthly) produce few trades, which is too small a sample to draw firm conclusions from. Test across multiple assets and timeframes.
— Optimizing the settings until the backtest looks great ("curve fitting") usually produces results that fall apart on live data. Prefer settings that are robust across many markets over ones that are perfect on one.
CREDITS & BASIS
Based on the open-source WaveTrend Oscillator concept (LazyBear) plus a standard RSI. Published open-source.
DISCLAIMER
For educational purposes only. Not financial advice. Backtested performance is hypothetical and does not represent actual trading. No system guarantees future profits. Trade at your own risk and never risk more than you can afford to lose.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.