# Looking for a smoothed 50sma?

#### jrajagopalan

##### New member
VIP
How to get Tradingview SMA setting in Thinkorswim?

#### Attachments

• 20230901_200520.jpg
711.6 KB · Views: 141
Solution
How to get Tradingview SMA setting in Thinkorswim?

i don't think there is one
here is a study that draws an average of an average.
it calculates a MA50, then smooths it by taking the MA3 average of it.

Code:
``````# smoothed_avg

def na = double.nan;
def bn = barnumber();

def price = close;

input avg1_len = 50;
#input avg1_type =  AverageType.EXPONENTIAL;
input avg1_type =  AverageType.simple;
def avg1 = MovingAverage(avg1_type, price, avg1_len);

input smooth_len = 3;
input smooth_type =  AverageType.simple;
def smooth_avg = MovingAverage(smooth_type, avg1, smooth_len);

input show_smooth_line = yes;
plot z1 = if show_smooth_line then smooth_avg else na;
z1.setdefaultcolor(color.cyan);
#z1.setlineweight(1);
z1.hidebubble();

input...``````
How to get Tradingview SMA setting in Thinkorswim?

i don't think there is one
here is a study that draws an average of an average.
it calculates a MA50, then smooths it by taking the MA3 average of it.

Code:
``````# smoothed_avg

def na = double.nan;
def bn = barnumber();

def price = close;

input avg1_len = 50;
#input avg1_type =  AverageType.EXPONENTIAL;
input avg1_type =  AverageType.simple;
def avg1 = MovingAverage(avg1_type, price, avg1_len);

input smooth_len = 3;
input smooth_type =  AverageType.simple;
def smooth_avg = MovingAverage(smooth_type, avg1, smooth_len);

input show_smooth_line = yes;
plot z1 = if show_smooth_line then smooth_avg else na;
z1.setdefaultcolor(color.cyan);
#z1.setlineweight(1);
z1.hidebubble();

input show_orig_line = no;
plot z2 = if show_orig_line then avg1 else na;
z2.setdefaultcolor(color.yellow);
#z2.setlineweight(1);
z2.hidebubble();
#``````

87k+ Posts
231 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?