emiliolb

Linear Regression Slope

1837 5 427
Script which calculates the linear regression slope, giving an idea where enter or exit in a market position.
Please if anybody have suggestions, let me know.
Remove from Favorite Scripts Add to Favorite Scripts
// Created by emiliolb -- Version 1.0
// Contact emiliolb@outlook.com 
study(title="Linear Regression Slope", shorttitle="LRS", overlay=true)

src = close[0]
len = input(defval=150, minval=1, title="Linear Regression Length")
lrc = linreg(src, len, 0)
plot(lrc, color = red, title = "Linear Regression Curve", style = line, linewidth = 2)

lrprev = linreg(close[1], len, 0)
slope = ((lrc - lrprev) / interval)

//Please if somebody have suggestions how show this better, let me know
codiff = slope
plotarrow(codiff, colorup=teal, colordown=orange, transp=40)
can period of 14 of linreg be the most suitable setting for intraday trading?
Reply
What determines the length of the arrows? Thanks.
Reply
emiliolb coondawg71
Hi! I am sorry by delay, I saw now your message. I think the arrow length depends on the spread between high and low candle values, not 100% by very close
I am glad you like the tool, I am newbie in this on trading, I am learning on the fly these things.
Thanks!
Emilio
+1 Reply
emiliolb emiliolb
I looked up the code and this sentence determine the arrow's length "plotarrow(slope, colorup=teal, colordown=orange, transp=40)"
Reply
Nice Tool Emilio!
Reply
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体中文
繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out