Standard Deviation Channels X3 For ThinkOrSwim

M_Morisette

New member
  1. Great for novice traders
  2. Simple but effective.
  3. Reversion to the mean.

Code:
#
## Title: Standard Deviation Channels x3
## Author: Matt Morisette
## Date: 1/19/2022
## Original Study: TDA StandardDevChannel
#



## GLOBAL START ##
input price = close;
input fullRange = Yes;
input length = 21;

def regression;
def stdDeviation;
if (fullRange) {
    regression = InertiaAll(price);
    stdDeviation = stdevAll(price);
} else {
    regression = InertiaAll(price, length);
    stdDeviation = stdevAll(price, length);
}

plot MiddleLine = regression;
MiddleLine.SetDefaultColor(CreateColor(255, 236, 74));
MiddleLine.SetStyle(Curve.SHORT_DASH);
## GLOBAL END ##



## DEVIATION 1 ##
input deviation_1 = 1.0;
plot upperLine_1 = regression + deviation_1 * stdDeviation;
plot lowerLine_1 = regression - deviation_1 * stdDeviation;
upperLine_1.SetDefaultColor(CreateColor(255, 1, 154));
lowerLine_1.SetDefaultColor(CreateColor(255, 1, 154));



## DEVIATION 2 ##
input deviation_2 = 2.0;
plot upperLine_2 = regression + deviation_2 * stdDeviation;
plot lowerLine_2 = regression - deviation_2 * stdDeviation;
upperLine_2.SetDefaultColor(CreateColor(255, 249, 202));
lowerLine_2.SetDefaultColor(CreateColor(255, 249, 202));
upperLine_2.SetStyle(Curve.SHORT_DASH);
lowerLine_2.SetStyle(Curve.SHORT_DASH);



## DEVIATION 3 ##
input deviation_3 = 3.0;
plot upperLine_3 = regression + deviation_3 * stdDeviation;
plot lowerLine_3 = regression - deviation_3 * stdDeviation;
upperLine_3.SetDefaultColor(CreateColor(255, 129, 205));
lowerLine_3.SetDefaultColor(CreateColor(255, 129, 205));

Examples
B8hZm9k.png


ZKleeyI.png


ChuyIAn.png


Settings
0e1rbgm.png
 
I would like to find a Standard Deviation scan that would give me all the stocks that are currently above the + 2.5 stan. dev. line or below the -2.5 stan dev line. I've only found one written 4 years ago, however it gives zero stocks
 
I would like to find a Standard Deviation scan that would give me all the stocks that are currently above the + 2.5 stan. dev. line or below the -2.5 stan dev line. I've only found one written 4 years ago, however it gives zero stocks
input price = close;
input fullRange = Yes;
input length = 21;
def regression;
def stdDeviation;
if (fullRange) {
regression = InertiaAll(price);
stdDeviation = stdevAll(price);
} else {
regression = InertiaAll(price, length);
stdDeviation = stdevAll(price, length);
}
input deviation = 2.5;
plot upperLine = close >(regression + deviation * stdDeviation);
#plot lowerLine_3 = regression - deviation_3 * stdDeviation;
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
475 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top