NexusFi: Find Your Edge


Home Menu

 





Linear Regression Slope Indicator


Discussion in TradeStation

Updated
    1. trending_up 3,280 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
madeinnyc
Highland Park, TX
 
Posts: 36 since Jan 2020
Thanks Given: 17
Thanks Received: 20

This is a nice lower study to be used along with R Squared. If you are using a dark color background chart, be sure to change the plot line colors for better visibility:


 
Code
Indicator: Lin Regression Slope
inputs:
Price ( Close ),
Length( 20 ),
UpLineColor( Green ),
DnLineColor( Red ) ;

variables:
LRS( 0 ) ;

LRS = LinearRegSlope( Price, Length ) ;
Plot1( LRS, "LRS" ) ;

if LRS > 0 then
SetPlotColor( 1, UpLineColor )
else
SetPlotColor( 1, DnLineColor ) ;

Indicator: RSquared
inputs:
Price( Close ),
LinearRegLength( 20 ),
RSquaredLength( 20 ),
Threshold( 0.2 ),
AlertBarLength( 1 ),
ChartRSquaredColor( Yellow ),
ChartThreshLineColor( Red ),
RadarAlertBGColor( Red ),
RadarAlertTextColor( Black ),
RadarNoAlertBGColor( Black ) ,
RadarNoAlertTextColor( White ) ;

variables:
ApplicationType( 0 ),
AlertBarNum( 0 ),
LinRegVal( 0 ),
RSquared( 0 ) ;

if CurrentBar = 1 then
ApplicationType = GetAppInfo( aiApplicationType ) ;

LinRegVal = LinearRegValue( Price, LinearRegLength,0 ) ;
RSquared = RSquare( Price, LinRegVal, RSquaredLength ) ;

Plot1( Threshold, "R^2Trig" ) ;
Plot2( RSquared, "R^2" ) ;

if RSquared crosses over Threshold then
AlertBarNum = CurrentBar ;

if ApplicationType = cRadarScreen then
begin
if CurrentBar < AlertBarNum + AlertBarLength then
begin
SetPlotBGColor( 2, RadarAlertBGColor ) ;
SetPlotColor ( 2, RadarAlertTextColor ) ;
Alert( "RSquared crossing up through " + "threshold level." ) ;
end
else
begin
SetPlotBGColor( 2, RadarNoAlertBGColor ) ;
SetPlotColor ( 2, RadarNoAlertTextColor ) ;
end ;
end
else
begin
SetPlotColor( 1, ChartThreshLineColor ) ;
SetPlotColor( 2, ChartRSquaredColor ) ;
end ;


Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Trump Media to sell instant access to market-moving soci …
Traders Hideout
No book, only a stair: journaling fills where price move …
Cryptocurrency
Datafeed for Atas
Platforms and Indicators
EA
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
BERN ALGOS algo trading journal
3 thanks
NexusFi site changelog and issues/problem reporting
2 thanks
TopStep Trader disappointment
2 thanks
Want your NinjaTrader indicator created, free?
1 thanks
Running trading strategies on a VPS
1 thanks
  #2 (permalink)
 
Tripken's Avatar
 Tripken 
Knoxville, TN/USA
Legendary Market Wizard
 
Experience: Beginner
Platform: TradeStation
Broker: TradeStation
Trading: ES
Frequency: Several times daily
Duration: Minutes
Posts: 641 since Feb 2010
Thanks Given: 1,750
Thanks Received: 1,428

Curious what your indicator does, could you post a screenshot of a chart?

I use an indi called linear regression High/Low on TS.

Thanks.


Reply With Quote




Last Updated on July 5, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts