This study shows the linear regression in a way to easily spot trends, S/R levels, reversals, choppiness, trading ranges, patterns, flags.
This script requires very few and easy to understand parameters, the length of analysis and the width of the slide. The default values are good for most scenarios.
This script requires very few and easy to understand parameters, the length of analysis and the width of the slide. The default values are good for most scenarios.
// Madrid : 28/lrcy/2015 23:00 : Slide : 1.0 // This study shows the linear regression in an easy visual way // to spot S/R points, reversals, choppiness, range trading, patterns // study("Madrid Slide", shorttitle="MSlide", overlay=true) src = hl2 len=input(13) w = input(defval=4, title="width", minval=1, maxval=7, step=1) lrc = linreg(src, len, 0) lrcColor=change(lrc) >= 0 ? lime:red plot(lrc, color=lrcColor, linewidth=3) plot(w>=7?lrc:na, offset=7, color=lrcColor) plot(w>=6?lrc:na, offset=6, color=lrcColor) plot(w>=5?lrc:na, offset=5, color=lrcColor) plot(w>=4?lrc:na, offset=4, color=lrcColor) plot(w>=3?lrc:na, offset=3, color=lrcColor) plot(w>=2?lrc:na, offset=2, color=lrcColor) plot(w>=1?lrc:na, offset=1, color=lrcColor) plot(w>=7?lrc:na, offset=-7, color=lrcColor) plot(w>=6?lrc:na, offset=-6, color=lrcColor) plot(w>=5?lrc:na, offset=-5, color=lrcColor) plot(w>=4?lrc:na, offset=-4, color=lrcColor) plot(w>=3?lrc:na, offset=-3, color=lrcColor) plot(w>=2?lrc:na, offset=-2, color=lrcColor) plot(w>=1?lrc:na, offset=-1, color=lrcColor)