ATR Adaptive Moving Average

Is there a way to create a moving average that instead of using fixed values, it integrated the ATR to be less/more reactive based on current volatility? The goal would be to have a moving average that in volatile times, it moves very rapidly with the changes and focuses on the short-term, whereas in steady times, it is less likely to get caught in the dips and valleys of price and focuses more on the big picture.
 
Solution
Is there a way to create a moving average that instead of using fixed values, it integrated the ATR to be less/more reactive based on current volatility? The goal would be to have a moving average that in volatile times, it moves very rapidly with the changes and focuses on the short-term, whereas in steady times, it is less likely to get caught in the dips and valleys of price and focuses more on the big picture.
It sounds like you are looking for the ToS AMA: https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/M-N/MovAvgAdaptive
TOS MovAvgAdaptive
The Adaptive Moving Average (AMA) is a moving average that changes its sensitivity to price moves depending on the calculated volatility.
...
Is there a way to create a moving average that instead of using fixed values, it integrated the ATR to be less/more reactive based on current volatility? The goal would be to have a moving average that in volatile times, it moves very rapidly with the changes and focuses on the short-term, whereas in steady times, it is less likely to get caught in the dips and valleys of price and focuses more on the big picture.
Have you considered using Heikin Ashi bars and/or writing code to plot their Open on a Candlestick chart?
 

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

Is there a way to create a moving average that instead of using fixed values, it integrated the ATR to be less/more reactive based on current volatility? The goal would be to have a moving average that in volatile times, it moves very rapidly with the changes and focuses on the short-term, whereas in steady times, it is less likely to get caught in the dips and valleys of price and focuses more on the big picture.
It sounds like you are looking for the ToS AMA: https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/M-N/MovAvgAdaptive
TOS MovAvgAdaptive
The Adaptive Moving Average (AMA) is a moving average that changes its sensitivity to price moves depending on the calculated volatility.
Investopedia states: https://www.investopedia.com/articles/trading/08/adaptive-moving-averages.asp
the adaptive moving average is an interesting newer idea with considerable intellectual appeal, our preliminary tests fail to show any real practical advantage to this more complex trend smoothing method." This doesn't mean traders should ignore the idea. The AMA could be combined with other indicators to develop a profitable trading system.
 
Solution
@SleepyZ I am trying to create a top moving average indicator. Please if you can take a look. Welcome all recommendation!

Ruby:
input price = close;
input price1 = high;
input displace = 0;
input length = 200;
input length1 = 500;
input length2 = 100;
input length4 = 1000;
input atrmod=2;
def bn = barnumber();
def lastBar = highestall(if isnan(close) then 0 else bn);
def offset = bn - lastbar;

input averageType = AverageType.EXPONENTIAL;


input length3 = 9;
input showBreakoutSignals = no;

input length5 = 252;
input averageType1 = AverageType.WILDERS;

def atr = GetValue(ATR(length), offset);


# User Inputs

def Num_Dev_Dn = atr;
def Num_Dev_up = -atr;

plot top200AvgExp = ExpAverage(price[-displace], length) * 1.06;
plot top200AvgExpupBand = top200AvgExp + Num_Dev_Dn ;
top200AvgExpupBand.Hide();
plot top200AvgExplowBand = top200AvgExp + Num_Dev_up ;
top200AvgExplowBand.Hide();
AddCloud(top200AvgExp, top200AvgExpupBand,  Color.WHITE, Color.WHITE);
AddCloud(top200AvgExp, top200AvgExplowBand,  Color.WHITE, Color.WHITE);
top200AvgExp.SetDefaultColor(Color.MAGENTA);
######################################################################

plot top100AvgExp = ExpAverage(price[-displace], length2) * 1.08;
plot top100AvgExpupBand = top100AvgExp + Num_Dev_up ;
top100AvgExpupBand.Hide();
plot top100AvgExplowBand = top100AvgExp + Num_Dev_Dn ;
top100AvgExplowBand.Hide();
AddCloud(top100AvgExp, top100AvgExpupBand,  Color.WHITE, Color.WHITE);
AddCloud(top100AvgExp, top100AvgExplowBand,  Color.WHITE, Color.WHITE);
top100AvgExp.SetDefaultColor(Color.CYAN);


##################################################################
plot top500AvgExp = ExpAverage(price[-displace], length1) * 1.05;
top500AvgExp.SetDefaultColor(Color.YELLOW);
plot top500AvgExpupBand = top500AvgExp + Num_Dev_Dn ;
top500AvgExpupBand.Hide();
plot top500AvgExplowBand = top500AvgExp + Num_Dev_up ;
top500AvgExplowBand.Hide();
AddCloud(top500AvgExp, top500AvgExpupBand,  Color.WHITE, Color.WHITE);
AddCloud(top500AvgExp, top500AvgExplowBand,  Color.WHITE, Color.WHITE);

##########################################################################
plot top100AvgExp1 = ExpAverage(price[-displace], length2) * 1.19;
plot top100AvgExp1upBand = top100AvgExp1 + Num_Dev_Dn ;
top100AvgExp1upBand.Hide();
plot top100AvgExp1lowBand = top100AvgExp1 + Num_Dev_up ;
top100AvgExp1lowBand.Hide();
AddCloud(top100AvgExp1, top100AvgExp1upBand,  Color.WHITE, Color.WHITE);
AddCloud(top100AvgExp1, top100AvgExp1lowBand,  Color.WHITE, Color.WHITE);
top100AvgExp1.SetDefaultColor(Color.DARK_ORANGE);

def data = close;
def top200 = top200AvgExp - data;
plot dist200 = Round(top200 / top100AvgExp * 100, 2);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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