NexusFi: Find Your Edge


Home Menu

 





Linear Regression Slope Indicator


Discussion in TradeStation

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




 
Search this Thread

Linear Regression Slope Indicator

  #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
The following 4 users say Thank You to madeinnyc for this post:

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Request for MACD with option to use different MAs for fa …
NinjaTrader
ZombieSqueeze
Platforms and Indicators
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
55 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
What percentage per day is possible? [Poll]
31 thanks
GFIs1 1 DAX trade per day journal
29 thanks

  #2 (permalink)
 
Tripken's Avatar
 Tripken 
Knoxville, TN/USA
Market Wizard
 
Experience: Beginner
Platform: TradeStation
Broker: TradeStation
Trading: ES
Frequency: Several times daily
Duration: Minutes
Posts: 623 since Feb 2010
Thanks Given: 1,562
Thanks Received: 1,364

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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts