ATR with Standard Deviation and Average for ThinkorSwim

skynetgen

Well-known member
ITs quite revealing about certain market behavior.

thinkScript Code

Code:
#skynetgen
#atr with stdev

declare lower;

input length = 14;
input averageType = AverageType.WILDERS;
input avglength=20;

 
def tr = TrueRange(high, close, low);


plot ATR = MovingAverage(averageType, tr, length);
ATR.SetDefaultColor(GetColor(8));
plot avg=expAverage(atr,avglength);
addcloud(atr,avg,color.green,color.red);

#stdev code. put in relvalue which you want measure
input RelDevLength=20;
input numDev = 1.0;
input ExtraDev = 2.3;
input MegaDev=4;
input MinDev=-1.3;
def relvalue=tr;
def rawRelDev = (relvalue - Average(relvalue , RelDevLength)) / StDev(relvalue, RelDevLength);
def base=lowest(relvalue,20); def cutoff=relvalue;
plot relstdev=if rawreldev+base>=cutoff then cutoff else base+rawreldev;

relstdev.setpaintingStrategy(paintingStrategy.SQUARED_HISTOGRAM);
relstdev.assignValueColor(
    if rawreldev>=MegaDev then color.cyan
    else if rawreldev>ExtraDev then color.green
    else if rawreldev>NumDev then color.dark_green
    else if RawRelDev<MinDev then  color.DARK_GRAY
    else color.current
    );

https://tos.mx/O9llhgT
 
Last edited by a moderator:

Schmidt42205

New member
VIP
Having trouble scanning for Cyan bars, looking to add the following to the code " cyan. plot go=rawRelDev >= MegaDev;" so that I can scan for "Go to be true" but keep coming up with errors. Does anybody have any ideas on how to make this work? Thank you for everyone's help, this site is very useful!!!
 
Last edited:

bspratt22

Member
ITs quite revealing about certain market behavior.

thinkScript Code
Code:
#skynetgen
#atr with stdev

declare lower;

input length = 14;
input averageType = AverageType.WILDERS;
input avglength=20;

 
def tr = TrueRange(high, close, low);


plot ATR = MovingAverage(averageType, tr, length);
ATR.SetDefaultColor(GetColor(8));
plot avg=expAverage(atr,avglength);
addcloud(atr,avg,color.green,color.red);

#stdev code. put in relvalue which you want measure
input RelDevLength=20;
input numDev = 1.0;
input ExtraDev = 2.3;
input MegaDev=4;
input MinDev=-1.3;
def relvalue=tr;
def rawRelDev = (relvalue - Average(relvalue , RelDevLength)) / StDev(relvalue, RelDevLength);
def base=lowest(relvalue,20); def cutoff=relvalue;
plot relstdev=if rawreldev+base>=cutoff then cutoff else base+rawreldev;

relstdev.setpaintingStrategy(paintingStrategy.SQUARED_HISTOGRAM);
relstdev.assignValueColor(
    if rawreldev>=MegaDev then color.cyan
    else if rawreldev>ExtraDev then color.green
    else if rawreldev>NumDev then color.dark_green
    else if RawRelDev<MinDev then  color.DARK_GRAY
    else color.current
    );

https://tos.mx/O9llhgT
@skynetgen @MerryDay - can you please explain how you use your indicator? What the different colored bars represent and what you look for in a setup?
 
Last edited by a moderator:

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
@skynetgen @MerryDay - can you please explain how you use your indicator? What the different colored bars represent and what you look for in a setup?
Did you know that clicking on a member's avatar will allow you to see when a member was last seen on the uTS forum? @skynetgen has not been seen in a while. :(

This type of indicator is popular in its use as support & resistance.
 

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
the code not working, looking to add this code plot go=rawRelDev >= MegaDev; it keep coming up with error, how did you figure it out do you have any ideas on how to make it work? Thanks for the help.
Are you saying "coming up with error" when you cut and paste the code?
There are no errors. Try again to cut & paste. You should have an image that looks like this:
ATigzfq.png
 

jhorton56

Member
VIP
Where can I go to find out what these inputs mean?

input RelDevLength=20;
input numDev = 1.0;
input ExtraDev = 2.3;
input MegaDev=4;
input MinDev=-1.3;

Otherwise, this study makes absolutely no sense to me.
 
T

Thomas

Guest
Where can I go to find out what these inputs mean?

input RelDevLength=20;
input numDev = 1.0;
input ExtraDev = 2.3;
input MegaDev=4;
input MinDev=-1.3;

Otherwise, this study makes absolutely no sense to me.
If the information doesn't make sense to an educated guy, abandon this. Look for a simple indicator besides price, RSI can indicate the best of em, or just volume and price tells you all you need to know,....KISS==> simpler the better.
 
Last edited by a moderator:

Similar threads

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.
Top