OPEN-SOURCE SCRIPT
已更新 Sharp Reversal Oscillator

Sharp Reversal Oscillator
A reversal-timing oscillator that re-shapes price into a near-Gaussian form so turning points snap into sharp, clear extremes instead of rounded, ambiguous ones — then scores its own turns forward on your chart, in plain language, so you can see at a glance whether to act or wait.
Why these parts are combined (not a mashup for show). Three steps are stacked, each fixing the previous one's flaw. Raw price excursions are fat-tailed, so it's unclear where an extreme really is; a distribution-normalizing transform stretches values near the edges, turning a compressed extreme into a clear spike. But that transform is easily biased by trend — in a strong move it pins to one side — so the input is first band-pass cleaned (slow trend and fastest noise removed), leaving the tradable swing it should sharpen. The normalization window is then set from the market's measured dominant cycle rather than a fixed guess, so it stays tuned as cycles stretch and compress. The three only work as one tool.
How it works. Band-pass clean → locate price within its recent range, scaled to (−1, 1) → distribution-normalizing transform, smoothed → signal when the line crosses its one-bar trigger from an extreme. The window optionally follows a dominant cycle measured by autocorrelation of the band-passed price. Each signal is then labelled by a triple barrier — a profit target and an equal stop in ATR units, plus a time limit — so a "win" means the target was hit before the stop. Results split into in-sample and recent out-of-sample, with a confidence interval and a multiple-testing check.
How to use. Read the Verdict row (Long/Short signal, Watch, or Wait). Check Conviction — it reads "High" only when that signal type shows a positive edge that survives the statistical test on this symbol; otherwise treat it as context. Green wave above zero is up-pressure, red below is down; shaded bands are extremes; the faint line is the trigger. Best used with your own trend and risk plan, not alone.
What's original. The band-pass-cleaned input, the self-tuning window, the forward triple-barrier calibration with an out-of-sample split, and a conviction read that openly admits when there's no proven edge — instead of presenting every signal as equally reliable.
Inputs. Price source (change it for any market), reading mode (Simple/Pro), engine and self-tuning controls, extreme level, full calibration settings, and an auto-adapting dashboard legible on dark or light charts. Defaults are tuned for NSE:NIFTY1! intraday.
Honesty & limitations. Edge figures are computed on this chart's own history with overlapping windows and no costs — context, not a guaranteed backtest; past behaviour doesn't predict the future, and the cycle estimate lags at regime shifts.
Disclaimer: for research and education only. Not financial advice. Trading carries risk of loss; manage your own positions.
A reversal-timing oscillator that re-shapes price into a near-Gaussian form so turning points snap into sharp, clear extremes instead of rounded, ambiguous ones — then scores its own turns forward on your chart, in plain language, so you can see at a glance whether to act or wait.
Why these parts are combined (not a mashup for show). Three steps are stacked, each fixing the previous one's flaw. Raw price excursions are fat-tailed, so it's unclear where an extreme really is; a distribution-normalizing transform stretches values near the edges, turning a compressed extreme into a clear spike. But that transform is easily biased by trend — in a strong move it pins to one side — so the input is first band-pass cleaned (slow trend and fastest noise removed), leaving the tradable swing it should sharpen. The normalization window is then set from the market's measured dominant cycle rather than a fixed guess, so it stays tuned as cycles stretch and compress. The three only work as one tool.
How it works. Band-pass clean → locate price within its recent range, scaled to (−1, 1) → distribution-normalizing transform, smoothed → signal when the line crosses its one-bar trigger from an extreme. The window optionally follows a dominant cycle measured by autocorrelation of the band-passed price. Each signal is then labelled by a triple barrier — a profit target and an equal stop in ATR units, plus a time limit — so a "win" means the target was hit before the stop. Results split into in-sample and recent out-of-sample, with a confidence interval and a multiple-testing check.
How to use. Read the Verdict row (Long/Short signal, Watch, or Wait). Check Conviction — it reads "High" only when that signal type shows a positive edge that survives the statistical test on this symbol; otherwise treat it as context. Green wave above zero is up-pressure, red below is down; shaded bands are extremes; the faint line is the trigger. Best used with your own trend and risk plan, not alone.
What's original. The band-pass-cleaned input, the self-tuning window, the forward triple-barrier calibration with an out-of-sample split, and a conviction read that openly admits when there's no proven edge — instead of presenting every signal as equally reliable.
Inputs. Price source (change it for any market), reading mode (Simple/Pro), engine and self-tuning controls, extreme level, full calibration settings, and an auto-adapting dashboard legible on dark or light charts. Defaults are tuned for NSE:NIFTY1! intraday.
Honesty & limitations. Edge figures are computed on this chart's own history with overlapping windows and no costs — context, not a guaranteed backtest; past behaviour doesn't predict the future, and the cycle estimate lags at regime shifts.
Disclaimer: for research and education only. Not financial advice. Trading carries risk of loss; manage your own positions.
版本注释
Sharp Reversal Oscillator — v2Two changes in this update:
Performance: the forward-calibration engine now computes its triple-barrier outcome once per bar and reuses it, instead of recomputing the identical result three times — faster loading and lower runtime, signals and stats byte-for-byte unchanged.
New (optional, off by default): regime gate. Reversals can be restricted to the regime where they have an edge — ranging conditions rather than strong trends — using an efficiency-ratio read (Ranging-only by default, Trending-only selectable). It flows through the calibration, so the Edge row tells you whether it helps on your instrument. Existing behaviour is unchanged until you turn it on.
版本注释
v1.1 — Robustness + finishing pass- Robustness (important): the self-tuning cycle engine recomputed thousands of cosine/sine values
every bar, which could trip the "calculation timed out" error on deep history or very low
timeframes. Those values are constant, so they are now built once into a lookup table — identical
output, far lighter, no timeout. The script runs smoothly on 1m and long histories.
- Added a warm-up guard: while the adaptive window is on, signals are held (dashboard shows
"Warming up") until the cycle engine has enough history to tune meaningfully. Fixed-window mode is
unaffected.
- Added a Data Window (EXP_) export bus so the oscillator can feed other scripts via input.source().
- Added a cost model: a new "Round-trip cost (R)" input and a Net R row. Conviction now requires a
signal to BOTH beat its base rate (Wilson) AND survive costs — a gross edge that costs eat through
is not tradeable, and the panel now says so.
- Added the MPL-2.0 licence header.
Descriptive research tooling, in-sample statistics, not investment advice.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。