Variable Sine Wave Fit
By LuxAlgoFeb 18, 2026
Variable Sine Wave Fit is an indicator on Vela, our next-generation charting platform, written in Pine Script®.
The Variable Sine Wave Fit takes the sinewave indicator idea to a fully fitted model. Over a rolling window it uses Ordinary Least Squares to fit price with a sine wave whose amplitude can damp, expand, or stay constant, riding on a linear trend component. The curve is drawn solid across the last Window Size bars and dashed into the future, wrapped in RMSE bands showing how tightly price follows the model. The fit recalculates on new data and adjusts retrospectively, so read it as regime context rather than fixed signals.
How to Trade the Variable Sine Wave Fit?
- Price inside the RMSE bands: the modeled cycle remains valid. Trade with the oscillation's rhythm.
- Closes well outside the bands: the model is breaking down, often a regime shift or volatility expansion.
- Peaks and troughs of the dashed projection: candidate turning points for timing pullbacks, counter-trend scalps, and exits.
- Dashboard state: Damped, Expanding, or Constant amplitude paired with Trending or Ranging shows whether cycles are compressing, accelerating, or stable.
- Best Period: the grid-searched cycle length in bars, a live dominant cycle estimate for aligning swing expectations across timeframes.
A rising RMSE readout is information in itself: price is peeling away from the fitted structure, which often accompanies a transition between ranging and trending conditions.
Variable Sine Wave Fit Settings
- Window Size (N): bars used for the fit; larger windows capture broader cycles, smaller ones react faster.
- Auto Period / Fixed Period (P): search for the best cycle length automatically or pin it manually.
- Min/Max Search Period: boundaries for the automatic search.
- Forecast Length: bars the dashed projection extends.
- RMSE Band Multiplier: width of the error envelope.
- Dashboard visibility, position, and size are adjustable, as are the bullish/bearish and band colors.
Frequently Asked Questions
Free to use
Run it on Vela. Go further with a paid plan.
- Up to 500 strategy alerts, with webhook automation
- Up to 10× the chart history of Free
- Orderflow lookback up to full history
- More Quant usage to customize it, plus extra usage when you need it
- Futures data alongside crypto, stocks, forex and commodities
Also works on
Related indicators
Run it on Vela. Make it yours with Quant.
Open this indicator free on Vela, our next-generation charting platform. Then ask Quant, our coding agent built into Vela, to retune it or turn it into a backtested strategy of your own.





