# Relative Momentum Index MTF

#### Bodhi

##### New member
@samer800 Can you please convert this TOS Relative Momentum Index script into a multi time frame? 1 min, 3 min, and 5 min. Thank you in advance, you are a legend in this forum.

declare lower;

input length = 20;
input momentum = 5;

assert(momentum > 0, "'momentum' must be positive: " + momentum);

def emaInc = ExpAverage(Max(close - close[momentum], 0), length);
def emaDec = ExpAverage(Max(close[momentum] - close, 0), length);
plot RMI = if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec);
plot OverBought = 70;
plot OverSold = 30;

RMI.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

Solution
@samer800 Can you please convert this TOS Relative Momentum Index script into a multi time frame? 1 min, 3 min, and 5 min. Thank you in advance, you are a legend in this forum.

declare lower;

input length = 20;
input momentum = 5;

assert(momentum > 0, "'momentum' must be positive: " + momentum);

def emaInc = ExpAverage(Max(close - close[momentum], 0), length);
def emaDec = ExpAverage(Max(close[momentum] - close, 0), length);
plot RMI = if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec);
plot OverBought = 70;
plot OverSold = 30;

RMI.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

You can input the aggregation timeframe you wish to use at input agg

The image...
@samer800 Can you please convert this TOS Relative Momentum Index script into a multi time frame? 1 min, 3 min, and 5 min. Thank you in advance, you are a legend in this forum.

declare lower;

input length = 20;
input momentum = 5;

assert(momentum > 0, "'momentum' must be positive: " + momentum);

def emaInc = ExpAverage(Max(close - close[momentum], 0), length);
def emaDec = ExpAverage(Max(close[momentum] - close, 0), length);
plot RMI = if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec);
plot OverBought = 70;
plot OverSold = 30;

RMI.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

You can input the aggregation timeframe you wish to use at input agg

The image shows in the upper chart a 1m chart with the indicator set at 5m, both resulting in the same value on the right edge
Code:
``````declare lower;

input agg    = aggregationPeriod.MIN;
input length = 20;
input momentum = 5;

assert(momentum > 0, "'momentum' must be positive: " + momentum);

def emaInc = ExpAverage(Max(close(period = agg) - close(period = agg)[momentum], 0), length);
def emaDec = ExpAverage(Max(close(period = agg)[momentum] - close(period = agg), 0), length);
plot RMI = if isnan(close) then double.nan else if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec);
plot OverBought = 70;
plot OverSold = 30;

RMI.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

#``````

You can input the aggregation timeframe you wish to use at input agg

The image shows in the upper chart a 1m chart with the indicator set at 5m, both resulting in the same value on the right edge

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