Least-Squares Forecasting with a Smoothed Directional Filter
Summary
This script applies ordinary least squares over a rolling window to relate a lower-timeframe price series to a generated series based on the square root of price and a time-dependent component. It then smooths the regression output with a Karobein oscillator. Changes in the smoothed prediction define long and short signals: a local turn upward triggers a long, while a local turn downward triggers a short. Optional trailing exits can be enabled, and the script offers a setting that changes how lower-timeframe data is requested, described as a repainting choice.
The author reports testing on five-minute EUR/USD data and says settings should be adjusted for other timeframes and securities; no performance statistics are given. Although the script includes a non-repainting option, its use of higher-timeframe data with lookahead behavior and a selectable repainting mode warrants careful validation. The synthetic regression input and short lookback also limit how much the example demonstrates a conventional price forecast.
Key ideas
- The regression fits a rolling relationship between lower-timeframe price data and a generated series.
- A smoothed oscillator's local turning points provide the long and short signals.
- Trailing stops are optional and controlled by point and offset settings.
- The script was reported tested on five-minute EUR/USD data, with no performance statistics supplied.
- The repainting option and lookahead data handling require careful validation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.