Variable moving average standard deviation?

arod49

New member
I was wondering if its possible to add standard deviation to a variable moving average to create something similar to Bollinger Bands?
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Sure, you can take the following code from this script and replace VixFix with whatever variable you want.

Code:
# BollingerBands code

input ShowBollingerBands = No;
input displace = 0;
input BBlength = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.Simple;

def sDev = stdev(data = VixFix[-displace], length = BBlength);
def MidLine = MovingAverage(averageType, data = VixFix[-displace], length = BBlength);

def LowerBand = MidLine + num_Dev_Dn * sDev;
def UpperBand = MidLine + num_Dev_Up * sDev;
plot LB = if ShowBollingerBands then LowerBand else Double.NaN;
plot UB = if ShowBollingerBands then UpperBand else Double.NaN;
LB.SetDefaultColor(GetColor(0));
UB.SetDefaultColor(GetColor(5));

P.S: next time please post your question in the Questions forum.
 

Brain Monkey

New member
On think or swim, Im looking for a study that charts not just the simple moving average but also draws a channel around the SMA of 1 standard deviation away from the SMA. Is there a study for that?
 

rad14733

Well-known member
VIP
On think or swim, Im looking for a study that charts not just the simple moving average but also draws a channel around the SMA of 1 standard deviation away from the SMA. Is there a study for that?
Do a search for "sma deviation channels" and you'll find more than a few topics... Several studies exist... We shouldn't be expected to search for you and hand over the links...
 

Brain Monkey

New member
First of all, no one is asking You for anything. A simple, "Their called Bollinger bands, a study already exists." or if you simply don't know what you are talking about, don't have to say anything. I don't know what they are because I don't use indicators like that, but for you to come on here acting like you do and then to be smug about, I don't don't even know what to say about that. "SMA deviation channels" isn't a thing. If answering questions on a forum for answering questions is an issue what are you even doing here?
 

rad14733

Well-known member
VIP
@Brain Monkey I'm sorry you feel the way you do but the honest truth is that far too many members come asking questions and expecting to be hand fed rather than doing any actual research for themselves... Whether or not you fall into that category is subjective... It can be literally exhausting to come here throughout the day and see it happen over and over again... If you spent the time here that a few of us do then you would understand... I feel that a timely response to members questions is paramount, even if it isn't the answer they want...
 

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