UDAY_C_Santhakumar

UCSgears_Linear Regression Slope

This is version 1 of the Linear Regression Slope. In ideal world the Linear regression slope values will remain same for any time period length. because the equation is y = mx+b, where m is the slope. All I did here is m = y/x

The Main Purpose of this indicator is to see, if the Trend is accelerating or decelerating.

The first Blue bar will caution when a strong trend is losing strength. I will leave the rest for you to explore.

I picked AAPL again, because it does have both up and down trend, in the recent time.

Mistake in the code

Corrected Version -

Uday C Santhakumar
نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟
// Created by UCSgears -- Version 1
// Simple linear regression slope - Good way see if the trend is accelarating or decelarating

study(title="UCSGEARS - Linear Regression Slope", shorttitle="UCS-LRS", overlay=false)
src = close
len = input(defval=5, minval=1, title="Slope Length")
lrc = linreg(src, 50, 0)
lrs = (lrc[-len] - lrc)/len
alrs = sma(lrs,9)
loalrs = sma(lrs,50)

uacce = lrs > alrs and lrs > 0 and lrs > loalrs
dacce = lrs < alrs and lrs < 0 and lrs < loalrs

scolor = uacce ? green : dacce ? red : blue

plot(lrs, color = scolor, title = "Linear Regression Slope", style = histogram, linewidth = 4)
plot(alrs, color = black, title = "Average Slope")
plot(0, title = "Zero Line")