Linear Regression Indicator: Slope, Settings and a Worked Nifty Example
Learn the Linear Regression Indicator with a real Nifty worked example: slope value, futures lot size 75, and rupee profit after STT and charges.
Key Takeaways
- 1.The Linear Regression Indicator (LRI) plots the END point of a least squares best fit line across the last N closes, so on a 14 period setting it answers one question: where does the statistical trend say price should be right now.
- 2.The slope of that line is the real signal. A positive slope means the fitted trend is rising; a negative slope means it is falling. The slope value, measured in points per bar, tells you how fast.
- 3.A worked Nifty example below uses 14 real-style daily closes, computes the slope by hand (about 41 points per day), and converts a long futures trade into actual rupee profit after STT, brokerage and GST.
- 4.For Indian intraday and positional traders, LRI works best on Nifty, Bank Nifty and liquid large caps in trending phases and gives the most false signals in flat, choppy ranges.
- 5.F&O profit from trading this signal is taxed as business income at your slab rate, not as capital gains. There is no 20 percent STCG rate on futures and options.
What the Linear Regression Indicator Actually Plots
Most traders confuse the Linear Regression Indicator with a moving average. They are not the same. A moving average is the average of the last N closes. The Linear Regression Indicator fits a straight line through the last N closes using the least squares method, the same maths used in school statistics, and then plots the value of that line at the most recent bar. In plain terms, it draws the best straight line through your recent price action and marks where the line ends today.
Because the line is fitted, not averaged, the LRI reacts faster to a fresh trend than a simple moving average of the same length. When Nifty turns up sharply, the regression line tilts up almost immediately, while a 14 day simple moving average is still dragged down by the old closes. This is why position and swing traders on the NSE often prefer the regression line to a plain SMA for reading trend direction.
There are three related tools people muddle together. The Linear Regression Indicator is the end point of the fitted line. The Linear Regression Slope is just the steepness of that same line. The Linear Regression Channel adds two parallel lines, usually two standard deviations above and below, to show the normal trading band. This page focuses on the first two because the slope is where the tradable signal lives.
The Least Squares Maths in One Page
You do not need to compute this by hand to trade it, your platform does it, but seeing the formula once removes all mystery. For N bars, the slope of the best fit line is the sum of (x minus mean x) times (y minus mean y), divided by the sum of (x minus mean x) squared. Here x is the bar number (1, 2, 3 and so on) and y is the closing price. The intercept is then mean y minus slope times mean x, and the Linear Regression Indicator value at the last bar is intercept plus slope times the last x.
The key output for a trader is the slope, expressed in points per bar. On a daily Nifty chart, a slope of plus 41 means the fitted trend is rising by roughly 41 index points every day. On a 5 minute Bank Nifty chart, a slope of plus 8 means the fitted trend is climbing about 8 points every 5 minute candle. The sign tells you direction, the magnitude tells you conviction, and a flattening slope toward zero is your early warning that the trend is tiring.
Add the Linear Regression Slope as a separate sub window indicator below your price chart and watch the zero line. A slope crossing from below zero to above zero is a cleaner, earlier trend change signal than waiting for price to cross the regression line itself.
Worked Nifty Example: Computing the Slope by Hand
Let us use 14 illustrative daily closes for Nifty 50 that resemble a real uptrending fortnight. These numbers are for teaching and are not a forecast. Bar 1 is the oldest day, bar 14 is today.
| Bar (x) | Nifty close (y) | Bar (x) | Nifty close (y) |
|---|---|---|---|
| 1 | 24,520 | 8 | 24,795 |
| 2 | 24,560 | 9 | 24,830 |
| 3 | 24,610 | 10 | 24,880 |
| 4 | 24,640 | 11 | 24,910 |
| 5 | 24,700 | 12 | 24,965 |
| 6 | 24,720 | 13 | 25,010 |
| 7 | 24,770 | 14 | 25,060 |
The mean of x for bars 1 to 14 is 7.5. The mean of the 14 closes (y) works out to about 24,783. Running the least squares formula across these points gives a slope of approximately plus 41 points per day and an intercept near 24,475. So the regression line value at bar 14 is about 24,475 plus 41 times 14, which is roughly 25,049, almost exactly where today's close of 25,060 sits. The fitted trend and the actual price agree, and the positive slope confirms a healthy, steady uptrend of about 41 points per day.
This is the signal in numbers. The slope is positive and meaningful, not a flat near zero reading, so a trend follower treats pullbacks toward the regression line as buying zones rather than reasons to sell. If over the next three days that slope flattened toward plus 5 or turned negative, the same trader would tighten stops or step aside, because the statistical trend would be stalling.
Turning the Signal Into a Real Nifty Futures Trade and Rupee P&L
Now we convert that slope reading into an actual position with rupee profit and loss, including Indian charges. Assume a positional trader sees the plus 41 slope, buys one lot of Nifty futures at 25,060, and exits eight sessions later at 25,360 as the uptrend continues. The Nifty futures lot size is 65. All figures below are illustrative and approximate, and actual broker charges vary.
- Entry: 1 lot Nifty futures at 25,060, so notional value is 25,060 times 75 equals 18,79,500 rupees.
- Exit: 25,360, a gain of 300 index points.
- Gross profit: 300 points times 75 equals 22,500 rupees.
Now subtract Indian costs. STT on futures is charged on the sell side at 0.02 percent of the sell turnover. Sell turnover is 25,360 times 75 equals 19,02,000, so STT is about 380 rupees. A typical discount broker charges a flat 20 rupees per order, so 40 rupees for the round trip. Exchange transaction charges and SEBI fees add roughly 45 to 50 rupees on this turnover, and GST at 18 percent applies on brokerage plus transaction charges, adding about 16 rupees. Stamp duty on the buy side is around 30 rupees. Total costs land near 515 rupees.
| Item | Amount (rupees) |
|---|---|
| Gross profit (300 points x 75) | +22,500 |
| STT on sell side (0.02% of sell turnover) | -380 |
| Brokerage (flat 20 x 2 orders) | -40 |
| Exchange + SEBI charges | -49 |
| GST (18% on brokerage + txn) | -16 |
| Stamp duty (buy side) | -30 |
| Net profit (illustrative) | +21,985 |
So a 300 point move on one Nifty lot turns a 22,500 rupee gross gain into roughly 21,985 rupees net after all statutory and broker charges. The slope reading gave the conviction to hold through the eight sessions instead of booking the first 50 points. Note the flip side: had Nifty fallen 300 points instead, the same lot would have lost about 22,500 rupees plus charges, which is why a stop loss is non negotiable on a leveraged futures position. These returns are illustrative only and never guaranteed.
Profit you make trading Nifty or Bank Nifty futures and options is treated as business income and taxed at your income tax slab rate, not as capital gains. The 20 percent short term capital gains rate and the 12.5 percent long term rate above 1.25 lakh apply to delivery equity, not to F&O.
Reading the Slope: Direction, Strength and the Zero Cross
The single most useful habit is to read the slope, not just the line. A rising slope confirms a bullish trend, a falling slope confirms a bearish trend, and a slope hovering near zero warns that the instrument is ranging and that trend trades will likely whipsaw. The steeper the slope, the stronger the move, but an extremely steep slope can also signal an overstretched market due for a pullback toward the line.
- Slope clearly positive and price riding above the line: established uptrend, buy dips toward the line.
- Slope clearly negative and price below the line: established downtrend, sell rallies into the line.
- Slope flattening toward zero: trend exhaustion, tighten stops and reduce size.
- Slope crossing zero from below: early bullish reversal, confirm with volume before acting.
- Slope crossing zero from above: early bearish reversal, common at Nifty and Bank Nifty swing tops.
For a Bank Nifty intraday trader on a 5 minute chart, the slope is especially valuable around 9:15 am to 10:30 am, when the day's trend often sets. A firmly positive 5 minute slope after the opening range tells you to favour long setups for the session, while a slope that keeps crossing zero back and forth is a clear signal to stand aside because the index is rangebound.
Best Settings for Indian Indices and Stocks
The period controls sensitivity. A shorter period like 9 or 14 reacts fast and suits Bank Nifty and Nifty intraday and short swing trades, while a longer period like 50 or 100 smooths out noise and suits positional trades in large caps such as Reliance, HDFC Bank, TCS and Infosys. There is no single best number, it depends on your holding period and the instrument's volatility.
| Use case | Instrument example | Suggested LRI period |
|---|---|---|
| Intraday scalping | Bank Nifty 5 min | 9 to 14 |
| Intraday trend | Nifty 15 min | 14 to 20 |
| Short swing (days) | Reliance, HDFC Bank daily | 20 |
| Positional (weeks) | TCS, Infosys daily | 50 |
| Long term trend | Nifty 50 weekly | 100 |
Bank Nifty moves faster and wider than Nifty, so many intraday traders run a slightly shorter period on Bank Nifty to keep up with its swings. For single stocks, remember that a corporate event, a results day, or a block deal can break the trend regardless of what the regression line says, so always check the calendar before relying on the slope alone.
Linear Regression Indicator vs Moving Average vs LSMA
Traders frequently ask how the Linear Regression Indicator differs from a simple moving average and from the Least Squares Moving Average, often called LSMA or the Moving Linear Regression. The table below clears it up. The crucial point is that the LRI and the LSMA are essentially the same value plotted as a moving line, while a simple moving average is a fundamentally different, slower calculation.
| Feature | Simple Moving Average | Linear Regression Indicator / LSMA |
|---|---|---|
| What it computes | Average of last N closes | End point of best fit line over last N closes |
| Lag | Higher, drags behind turns | Lower, tilts with the new trend fast |
| Direction signal | Line slope, sluggish | Slope value, responsive and quantifiable |
| Best for | Smoothing very noisy data | Reading trend direction and strength |
| Risk in ranges | Flat, few false signals | More false crosses in choppy markets |
Because the regression line is more responsive, it gives earlier signals but also more false ones in sideways markets. That trade off is the heart of using it well. Pair it with a momentum tool so you only act on slope signals that have momentum behind them.
Combining LRI With RSI and Volume to Cut False Signals
The Linear Regression Indicator is a trend tool, so it pairs naturally with a momentum tool and a participation tool. A common, reliable combination for Indian markets is the regression slope for direction, the Relative Strength Index for momentum confirmation, and volume for conviction. You take a long only when all three agree: positive slope, RSI above 50 and rising, and above average volume on up moves.
- Direction filter: regression slope positive for longs, negative for shorts.
- Momentum filter: RSI above 50 for longs, below 50 for shorts, with no bearish divergence.
- Conviction filter: volume expanding in the direction of the trend, not on the counter moves.
- Exit trigger: slope flattening to near zero or RSI losing the 50 line.
This three filter approach dramatically reduces the false signals that plague the regression line in isolation. In a choppy Nifty week, the slope alone might flip three or four times, but requiring RSI and volume agreement filters most of those whipsaws out, so you only trade when the market is genuinely committed to a direction.
Limitations, False Signals and Risk Control
The Linear Regression Indicator is a lagging tool built from past closes, so it cannot predict gap downs on bad results, a surprise RBI policy move, or a global selloff that hits Nifty at the open. It also assumes price moves in a straight line, which is rarely true for long, so in extended sideways ranges the slope drifts around zero and produces frequent, low quality crosses. Treating every line cross as a trade in such conditions is the fastest way to bleed capital on brokerage and small losses.
Risk control must sit on top of the signal, never the other way round. On the worked futures example, one lot carries about 18.8 lakh of notional exposure, so a 1 percent adverse move is roughly 18,800 rupees at risk. A disciplined trader sizes the position so that the loss to a sensible stop, often placed below the regression channel's lower band, stays within 1 to 2 percent of total capital. Use a stop loss calculator to set this precisely before entering, not after.
On a leveraged Nifty or Bank Nifty futures position, decide your maximum rupee loss first, then derive your stop and lot size from it. The slope tells you when the odds favour a trade, but position sizing decides whether one bad trade is survivable.
Sources and Further Reading
For authoritative data, current contract specifications and tax rules, refer to Zerodha Varsity, Investopedia and NSE India. Lot sizes, STT rates and charges change periodically, so always confirm the current numbers on the official source before you trade. All examples on this page are illustrative and are not investment advice or a promise of returns.
Sources and Further Reading
For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia and NSE India. Always confirm current rules, rates and contract specifications on the official source before you trade.
Related Topics
Related Articles
Understanding the Flag Pattern in Indian Markets
How to trade bullish and bearish flag patterns on Nifty, Bank Nifty and NSE stocks, with a worked example, costs, taxes and honest reliability data.
Understanding the Vertical Horizontal Filter in Indian Markets
How the VHF spots trending vs ranging Nifty, with real NSE regimes, a worked calculation, option tactics, and Indian F&O tax rules.
RSI 2 Period Strategy for Indian Markets
The RSI(2) mean reversion strategy for Indian markets: 200 DMA filter, exact entry and exit rules, and worked Reliance and Bank Nifty rupee examples.
Understanding Trading Psychology in Indian Markets
Learn trading psychology for Indian markets with a worked Nifty options example showing how fear and greed turned a Rs 3,600 loss into Rs 16,500.
Understanding Short Selling in Indian Markets
How short selling works in India: the intraday-only retail rule, SEBI SLB overnight borrowing with a real Reliance borrow-cost example, F&O shorts and tax.
How to Rebalance Your Portfolio in Indian Markets
How to rebalance your Indian portfolio with the correct post-2024 tax: 20% STCG, 12.5% LTCG above Rs 1.25 lakh, plus a worked Nifty example.
The trading journal built for Indian F&O traders. Track your trades, spot patterns, build discipline.
- Log one trade a day by hand, on purpose
- AI mentor finds your repeat mistakes
- Behavioural analytics catch tilt early
- Trading calendar with P&L heatmap
- Pre-trade checklist flags risks
Yearly ₹2,499 · No broker credentials