# 10day MA of 52-week high minus 52-week low

Solution
Hello all,
Seeking study/indicator that calculates 10-day MA of new 52-week highs minus new 52-week lows for NYSE
Such as the one here under section "Moving Average Smoothing": https://school.stockcharts.com/doku.php?id=market_indicators:net_new_highs

Thanks

this is a lower study that does what you asked

Code:
``````#hilo_52week_diff_avg

declare lower;

def na = Double.NaN;
def bn = BarNumber();

input weeks = 52;
input agg = AggregationPeriod.week;
def hi = highest(high(period = agg), weeks);
def lo = lowest(low(period = agg), weeks);
def diff = hi-lo;

#input avg1_type = AverageType.exponential;
input avg1_type = AverageType.Simple;
input avg1_length = 10;
def avg1 = MovingAverage(avg1_type, diff, avg1_length );

plot z =...``````
Hello all,
Seeking study/indicator that calculates 10-day MA of new 52-week highs minus new 52-week lows for NYSE
Such as the one here under section "Moving Average Smoothing": https://school.stockcharts.com/doku.php?id=market_indicators:net_new_highs

Thanks

this is a lower study that does what you asked

Code:
``````#hilo_52week_diff_avg

declare lower;

def na = Double.NaN;
def bn = BarNumber();

input weeks = 52;
input agg = AggregationPeriod.week;
def hi = highest(high(period = agg), weeks);
def lo = lowest(low(period = agg), weeks);
def diff = hi-lo;

#input avg1_type = AverageType.exponential;
input avg1_type = AverageType.Simple;
input avg1_length = 10;
def avg1 = MovingAverage(avg1_type, diff, avg1_length );

plot z = avg1;
#``````

or could use days (chart set to day) instead of weeks, and not use 2nd aggregation

#### Attachments

• Capture.JPG
33.4 KB · Views: 41
Last edited:

87k+ Posts
308 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?