NosTraderMus LinearRegressionBands
- Indicators
- Victor Gauto
- Version: 1.24
- Activations: 5
LinearRegressionBands – Intelligent signals with Regression Channels + RSI
Turn market reading into a clear, visual decision. LinearRegressionBands draws a linear regression line over the recent price window and generates dynamic channels (± standard deviations) to identify extremes. Entry arrows appear only when there is a genuine band breakout accompanied by an extreme RSI confirmation; optionally, you can require the regression slope to align with the signal (trend-only mode).
What does it solve?
-
High-probability pullbacks: in “trend-only” mode, it looks for buys on pullbacks within an up-slope and sells on bounces within a down-slope.
-
Controlled mean-reversion: if you disable the trend requirement, it captures extremes when bands are broken with an extreme RSI reading—useful for carefully filtered counter-trend strategies.
-
Less noise than horizontal channels: unlike classical bands, regression channels tilt with price, aligning with the dominant direction and reducing misleading signals.
Key advantages
-
Clean, objective signals: arrows only when the band is broken (no tolerances) and RSI confirms the extreme.
-
One-click Trend mode: set OnlyInTrend=true to require a favorable slope (m>0 for buys, m<0 for sells). Ideal for “buying the dip” and “selling the pop” within the trend.
-
Multi-asset and multi-timeframe: works on FX, indices, commodities, crypto, and any timeframe.
-
Non-repainting arrows: evaluated on a closed bar (RSI_Shift=1 by default), preventing arrows from changing afterward.
-
Lightweight and stable: optimized calculations that won’t overload your platform.
How it works (plain)
-
Computes the linear regression over RegPeriod bars and the standard deviation of residuals.
-
Draws the center line and the upper/lower bands = line ± StdDevFactor × sigma.
-
Buy: if the Low of the closed bar breaks below the lower band and RSI < RSI_Oversold (and, if OnlyInTrend=true, slope m>0).
Sell: if the High breaks above the upper band and RSI > RSI_Overbought (and, if OnlyInTrend=true, slope m<0). -
Plots an arrow at the signal point.
Recommended usage styles
-
Trend-following (pullbacks with confirmation): OnlyInTrend=true. Typical exits: center line, opposite band, or RSI crossing back through 50.
-
Selective counter-trend: OnlyInTrend=false plus stricter RSI thresholds (e.g., 80/20). Favor higher timeframes and range-bound contexts.
-
Top-down: define trend on H4/D1 and execute signals on M15/H1 (keep RSITimeframe = PERIOD_CURRENT or try RSI on a higher TF).
Suggested configurations (starting points)
-
Scalping M5–M15: RegPeriod 14–20, StdDevFactor 1.8–2.2, RSI 7–14, RSI_Overbought 75–80, RSI_Oversold 20–25, OnlyInTrend=true.
-
Intraday M15–H1: RegPeriod 20–40, StdDevFactor 2.0, RSI 14, 70/30, OnlyInTrend=true.
-
Swing H4–D1: RegPeriod 50–100, StdDevFactor 2.0–2.5, RSI 14, 65/35 or 60/40 depending on volatility, OnlyInTrend=true.
External parameters: meaning and how to configure
RegPeriod (int, default 20)
Number of bars used to compute the regression.
Effect: shorter periods = higher sensitivity (more signals, more noise); longer = smoother (fewer signals, higher quality).
Tip: intraday 14–40; swing 50–100.
StdDevFactor (double, default 2.0)
Standard-deviation multiplier defining band width.
Effect: higher factor = wider bands (fewer touches, more selective signals).
Tip: 2.0 is a robust standard; raise to 2.5 in highly volatile markets.
PriceType (int, 0=Close; 1=Open; 2=High; 3=Low; 4=Average; 5=Typical)
Base price used to build the regression/bands.
Effect: Close is the most common; Typical (H+L+C)/3 can soften extremes; Average (O+C)/2 is also stable.
Tip: keep Close unless you specifically want smoothing.
RSIPeriod (int, default 14)
RSI length.
Effect: shorter = more reactive RSI; longer = more stable.
Tip: standard is 14; scalping 7–10; swing 14–21.
RSITimeframe (ENUM_TIMEFRAMES, default PERIOD_CURRENT)
Timeframe used to compute RSI.
Effect: a higher TF can filter noise (slower confirmation).
Tip: keep current; for a macro filter, try a higher TF.
RSI_Overbought (double, default 70.0)
Overbought threshold (sell).
Effect: the higher it is, the fewer but more extreme signals.
Tip: intraday 70–80; in wide ranges, push to 80.
RSI_Oversold (double, default 30.0)
Oversold threshold (buy).
Effect: the lower it is, the fewer but more extreme signals.
Tip: intraday 20–30; in wide ranges, push down to 20.
RSI_Shift (int, default 1)
Bar used to confirm the signal (1 = closed bar).
Effect: at 1 you avoid arrow repainting; 0 would signal on a forming bar (not recommended).
Tip: keep it at 1.
OnlyInTrend (bool, default true)
Require the regression slope to align with the trade direction.
Effect: true → buy only if m>0 and sell only if m<0 (pullbacks within trend). false → ignore slope (useful for filtered counter-trend).
Tip: true for most strategies; false only if you master range contexts.
Best practices and trade management
Stop-loss: below/above the signal bar’s low/high, or a fraction of the opposite band.
Take-profit: center line, opposite band, or exit when RSI returns to 50.
Additional filter: avoid high-impact macro news if your instrument is sensitive; consider pairing with an ATR-based volatility filter for position sizing.
Important: this indicator is not financial advice and does not guarantee performance. Use with a clear risk-management plan and test on a demo account before going live.

