#tradingview like Linear Channel w/ fills
#@JonPM Community Request
#
#VERSION
# 2020.09.08 V1.0 @diazlaz - Linear Regression Channel with Cloud and variable
# timeframe.
#
input price = close;
input deviations = .8; #set your deviation units here.
input length = 100; #set your channel lookback period here.
def regression = InertiaAll(price, length);
def stdDeviation = stdevAll(price, length);
plot UpperLine = regression + deviations * stdDeviation;
plot MiddleLine = regression;
plot LowerLine = regression - deviations * stdDeviation;
AddCloud (MiddleLine, UpperLine, COLOR.GREEN, COLOR.GREEN);
AddCloud (MiddleLine, LowerLine, COLOR.RED, COLOR.RED);
UpperLine.SetDefaultColor(COLOR.GREEN);
MiddleLine.SetDefaultColor(GetColor(8));
LowerLine.SetDefaultColor(COLOR.RED);
#END of tradingview like Linear Channel w/ fills
#tradingview like Linear Channel w/ fills
#@JonPM Community Request
#
#VERSION
# 2020.09.08 V1.0 @diazlaz - Linear Regression Channel with Cloud and variable
# timeframe.
#
input price = close;
input deviations = .8; #set your deviation units here.
input length = 100; #set your channel lookback period here.
input opacity = 50;
def regression = InertiaAll(price, length);
def stdDeviation = stdevAll(price, length);
plot UpperLine = regression + deviations * stdDeviation;
plot MiddleLine = regression;
plot LowerLine = regression - deviations * stdDeviation;
AddCloud(MiddleLine, UpperLine, Color.GREEN, Color.GREEN, opacity);
AddCloud(MiddleLine, LowerLine, Color.RED, Color.RED, opacity);
UpperLine.SetDefaultColor(Color.GREEN);
MiddleLine.SetDefaultColor(GetColor(8));
LowerLine.SetDefaultColor(Color.RED);
#END of tradingview like Linear Channel w/ fills
# LRC no Lines Global Color Adj
# With help from coder in TOS chat support 9-18-2020
# Originally: tradingview like Linear Channel w/ fills
# @JonPM Community Request in useThinkscript
# VERSION
# 2020.09.08 V1.0 @diazlaz - Linear Regression Channel with Cloud and variable
# timeframe.
# 2020.09.18 V1.1 @markos - Color Opacity can now be changed via Globals in UI.
input price = close;
input deviations = 1.0; #set your deviation units here.
input length = 80; #set your channel lookback period here.
def regression = InertiaAll(price, length);
def stdDeviation = StDevAll(price, length);
def UpCloud = regression + deviations * stdDeviation;
def DnCloud = regression - deviations * stdDeviation;
def MiddleLine = regression;
DefineGlobalColor("Bullish", Color.light_green);
DefineGlobalColor("Bearish", Color.light_RED);
AddCloud(middleline, upcloud, GlobalColor("Bullish"), GlobalColor("Bullish"));
AddCloud(middleline, dncloud, GlobalColor("Bearish"), GlobalColor("Bearish"));
# End LRC wo Lines
You don't really trade based on this alone. The green and red zones give you an idea of possible support and resistance as well as the overall trend direction. Just notice how the price seems to bump up and down near the top, bottom and middle.How do you guys trade using this?
VERY NICE..TY
http://tos.mx/N6lW6NE
@diazlaz @Ficus I wanted to have an LRC that was opaque. This was done w help from TOS Support.
Color Opacity can be changed to what ever one wishes via the UI under Global Colors>More...>HSV color panel.
Code:# LRC no Lines Global Color Adj # With help from coder in TOS chat support 9-18-2020 # Originally: tradingview like Linear Channel w/ fills # @JonPM Community Request in useThinkscript # VERSION # 2020.09.08 V1.0 @diazlaz - Linear Regression Channel with Cloud and variable # timeframe. # 2020.09.18 V1.1 @markos - Color Opacity can now be changed via Globals in UI. input price = close; input deviations = 1.0; #set your deviation units here. input length = 80; #set your channel lookback period here. def regression = InertiaAll(price, length); def stdDeviation = StDevAll(price, length); def UpCloud = regression + deviations * stdDeviation; def DnCloud = regression - deviations * stdDeviation; def MiddleLine = regression; DefineGlobalColor("Bullish", Color.light_green); DefineGlobalColor("Bearish", Color.light_RED); AddCloud(middleline, upcloud, GlobalColor("Bullish"), GlobalColor("Bullish")); AddCloud(middleline, dncloud, GlobalColor("Bearish"), GlobalColor("Bearish")); # End LRC wo Lines
phewww you got your work cut out for you. What exactly are you going to use that for? Just curioushow do you code to count the number of times the middle line cuts through the body of the candle? Say input length is 80, so i want to see among the 80 candles, how many of the candle bodies got cut through by the middle line.
well, if the mid line cuts through most of the candle bodies, it means the trend is uniform and when there is pullback, i want to get in.phewww you got your work cut out for you. What exactly are you going to use that for? Just curious
oook, have at it.well, if the mid line cuts through most of the candle bodies, it means the trend is uniform and when there is pullback, i want to get in.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | HLC Trend - Tradingview script converted to TOS | Questions | 4 | |
Over 70+ TradingView Indicators Converted to ThinkorSwim | Custom | 10 | ||
M | Any tips on porting to TradingView? | Questions | 1 | |
M | What is the ValueWhen (TradingView) equivalent in ThinkScript? | Questions | 2 | |
S | Lux Algo Indicator from TradingView | Questions | 11 |