Relative Moving Average (RMA)

JP782

Active member
Im in the process of building a Hoffman Overlay that works with the IRB (Inventory Retracement Bar) but there is an indicator I need that doesnt exist on TOS that is in the tradingview vers
The Relative Moving Average(RMA) is used, and I was under the impression the Wilders worked like it but it does not after trying it in my setup. Does anyone have script for the RMA??

Pretty detailed description and the calculation of it RMA here but its a bit greek to me
 
Code:
input  Period1 = 20;
def Price = (Open+ Close)/2;
rec RMA = if BarNumber() < 3 then price else (1/Period1)*price +(1-(1/Period1))*RMA[1];
Plot RMAvg = RMA;
RMAvg.setdefaultColor(Color.Cyan);
RMAvg.SetLineWeight(3);

You can Change the Price to whatever you want
 
I am not sure I completely understand this indicator. What I am expecting is this indicator allows for plotting a moving average (EMA in this case) on a 15 min chart of the 60 min EMA (a higher time frame). Where do you designate what the higher time frame is? Example can I use this to plot a daily EMA on a 60 min chart. Where do you designate what the higher time frame is for the RMA?
 
here is a version that plots 2 RMA's with assigned price Color
Code:
input Period1 = 10;
input Period2 = 40;
input Price = Close;
input APC = no;
rec RMA1 = if BarNumber() < 3 then price else (1/Period1)*price +(1-(1/Period1))*RMA1[1];
Plot RMAvg1 = RMA1;
RMAvg1.setdefaultColor(Color.Cyan);
RMAvg1.SetLineWeight(3);

rec RMA2 = if BarNumber() < 3 then price else (1/Period2)*price +(1-(1/Period2))*RMA2[1];
Plot RMAvg2 = RMA2;
RMAvg2.setdefaultColor(Color.Magenta);
RMAvg2.SetLineWeight(3);
AssignPriceColor(If APC == yes and Price > RMA1 and RMA1 > RMA2 then Color.Green else if APC == yes and RMA1 > RMA2 then Color.Dark_Green else if APC == Yes and Price < RMA1 and RMA1 < RMA2 then Color.Red else if APC == Yes and RMA1 < RMA2 then Color.Dark_Red else if APC == yes then Color.Orange else Color.Current);
 
Sorry @henry1224 I don't understand what you are trying to tell me. The original indicator trying to be replicated is a simple 20 period EMA of the chart aggregation period of 15 min and then also placing a 20 period EMA on the same chart but using the 60 min aggregation period. I want to not only use the 15 and 60 min, but be able to change times like use a 5 min and 30 min. Does that make sense?
 
Sorry @henry1224 I don't understand what you are trying to tell me. The original indicator trying to be replicated is a simple 20 period EMA of the chart aggregation period of 15 min and then also placing a 20 period EMA on the same chart but using the 60 min aggregation period. I want to not only use the 15 and 60 min, but be able to change times like use a 5 min and 30 min. Does that make sense?
there is no mention of ATR

rec RMA1 = if BarNumber() < 3 then price else (1/Period1)*price +(1-(1/Period1))*RMA1[1];

If you want to plot something else that you want the average to apply to , then you have to substitute "Close" in the Input "Price"

You can only change the length of the average
 
@henry1224 I don't mention ATR because I don't know what the ATR has to do with what I am asking to begin with. @JP782 said -"turns out "RMA" is Wilders with ATR". I don't know what that is supposed to mean. I am looking for an EMA to plot with a different time increment then the chart. That is what the original post from @JP782 was asking about too. Am I missing something, or am I just stupid? (No answering please).
 
here is a version that plots 2 RMA's with assigned price Color
Code:
input Period1 = 10;
input Period2 = 40;
input Price = Close;
input APC = no;
rec RMA1 = if BarNumber() < 3 then price else (1/Period1)*price +(1-(1/Period1))*RMA1[1];
Plot RMAvg1 = RMA1;
RMAvg1.setdefaultColor(Color.Cyan);
RMAvg1.SetLineWeight(3);

rec RMA2 = if BarNumber() < 3 then price else (1/Period2)*price +(1-(1/Period2))*RMA2[1];
Plot RMAvg2 = RMA2;
RMAvg2.setdefaultColor(Color.Magenta);
RMAvg2.SetLineWeight(3);
AssignPriceColor(If APC == yes and Price > RMA1 and RMA1 > RMA2 then Color.Green else if APC == yes and RMA1 > RMA2 then Color.Dark_Green else if APC == Yes and Price < RMA1 and RMA1 < RMA2 then Color.Red else if APC == Yes and RMA1 < RMA2 then Color.Dark_Red else if APC == yes then Color.Orange else Color.Current);
I don't see it dynamically changing the color on the moving averages ...Can you fix it, please?
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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