Smoothed Moving Average For ThinkOrSwim

Piper2808t

Active member
2019 Donor
VIP
Can this be created in tos. its from trading view

Code:
study(title="Smoothed Moving Average", shorttitle="SMMA", overlay=true, resolution="")
len = input(7, minval=1, title="Length")
src = input(close, title="Source")
smma = 0.0
smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
plot(smma, color=color.red)
 

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

Code:
# Smoothed Moving Average
# Converted to thinkorswim from trading view by Alex Ivanov aka Metaller
# Sep 21, 2020

input len = 7;
input src = close;

rec smma  = if (IsNaN(smma[1]) or smma[1]==0) then SimpleMovingAvg(src, len) else (smma[1] * (len - 1) + src) / len;

plot smma_plot = smma;
smma_plot.setDefaultColor(color.red);
 
Interesting enough that SMMA provides virtually identical output as Wilders Moving Average :

Code:
input AvgType = AverageType.WILDERS;
input Price = close;
input Length = 7;
plot Data = MovingAverage(AvgType, Price, Length);

There is very small difference for first about 14 bars of chart (when len =7).
 
Think or swim has this study, im just looking for a way to make it like trading views, where it changes colors. Thanks in advance!
This study already exists in Thinkorswim. But the trading view version changes color. Im wondering if anyone is able to add the changing color function to the thinkorswim one.
Here are the pictures in comparison. The code is above, Hopefully this helps

Code:
//@version=2
//WELLES WILDER SMOOTHING / WILDER'S MOVING AVERAGE
//author: @fr3762 KIVANÇ
study("WILD MA", overlay=true)

malength = input(14, "length", minval=1)
wild=nz(wild[1])+(close-nz(wild[1]))/malength

col1= wild>wild[1]
col3= wild<wild[1]
color = col1 ? green : col3 ? red : yellow

plot(wild, color=color, linewidth=2, title="WILD")
 
Last edited by a moderator:
@MerryDay @rad14733 as I mentioned in my post, this study already exits in Thinkorswim. But the trading view version changes color. Im wondering if anyone is able to add the changing color function to the thinkorswim one.



Here are the pictures in comparison. The code is above, Hopefully this helps
Try this.
Code:
#WildersSmoothing_Colored

input price = close;
input length = 14;
input displace = 0;

plot WS = WildersAverage(price[-displace], length);

WS.setDefaultColor(getColor(0));
WS.AssignValueColor(if close>=WS then Color.Green else Color.Red);
 
Crazy as it sounds, I just added the TOS WildersSmoothing MA Study, with its default setting of 14 (Gray), onto one of my charts that already has a 34EMA (Yellow) on it and they are stunningly similar...

5EACVHk.png
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
189 Online
Create Post

Similar threads

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