Log-Scale Nadaraya-Watson Envelopes for Cross-Based Entries and Exits
Summary
This Pine Script strategy smooths log-transformed closing, high, and low prices with a custom Nadaraya-Watson kernel, then exponentiates the estimates to plot high and low envelope curves. It also computes an ATR-like measure from the smoothed prices and derives near and far volatility bands, although the entry and exit rules use the envelope curves rather than those additional bands.
In long-only mode, a close crossing above the lower envelope opens a long position, and a crossing back below the upper envelope closes it. Long/short mode adds short entries when price crosses below the upper envelope, with exits on opposite crossings of the lower envelope. The script is labeled non-repainting and includes configurable smoothing, weighting, ATR, and strategy settings. The supplied material provides code but no instrument, backtest results, transaction cost assumptions, or evidence supporting the non-repainting claim; performance and sensitivity to parameters therefore remain unestablished.
Key ideas
- A custom kernel smooths log prices to estimate separate high, low, and close envelope series.
- The strategy enters long when price crosses above the lower envelope and exits when it crosses back below the upper envelope.
- Long/short mode adds short entries on a downward crossing of the upper envelope and exits on a crossing of the lower envelope.
- ATR-based near and far bands are calculated, but the shown trade rules do not use them.
- The document provides no backtest results or transaction cost assumptions.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.