LazyBear's Intraday Momentum Index for Thinkorswim

netarchitech

Well-known member
VIP
imi.png


Another TradingView port...Looking forward to thoughts, feedback, backtests, etc...

Here's some additional information regarding the Intraday Momentum Index, courtesy of LazyBear:
The Intraday Momentum Index (IMI), developed by Tushar Chande, is a cross-breed between RSI and Candlestick analysis. IMI determines the candle type that dominated the recent price action, using that to pinpoint the extremes in intraday momentum.

As the market tries to bottom after a sell off, there are gradually more candles with green bodies, even though prices remain in a narrow range. IMI can be used to detect this shift, because its values will increase towards 70. Similarly, as the market begins to top, there will be more red candles, causing IMI to decline towards 20. When the market is in trading range, IMI values will be in the neutral range of 40 to 60.

Also in this port are volatility band-based OB/OS, in addition to fixed OB/OS levels. You can also turn on/off EhlersSuperSmoothing...

Code:
# filename: _Intraday_Momentum_Index_LB_
# source: https://www.tradingview.com/script/3CufgHsc-Indicator-Intrady-Momentum-Index/

# Original idea and execution:
# Code by LazyBear

# initial port by netarchitech
# 2019.11.06

declare lower;

input length = 14; #IMI Length
input lengthMA = 6; #IMI MA Length
input mult = 2.0; #Volatility Bands Stdev Mult
input lengthBB = 20; #Volatility Bands Length
input applySmoothing = yes; #Smooth IMI
input lowBand = 10; #Smoothing LowerBand

def PI = 3.14159265359;

input data = close;
input lower = low; #Research Lower = Low?

def a1 = Exp(-PI * Sqrt(2) / lower);
def coeff2 = 2 * a1 * Cos(Sqrt(2) * PI / lower);
def coeff3 = - Power(a1, 2);
def coeff1 = 1 - coeff2 - coeff3;
def filt = coeff1 * (data + (data[1])) / 2 + coeff2 * (filt[1]) + coeff3 * (filt[2]);

def gains = if close > open then (gains[1]) + (close - open) else 0;
def losses = if close < open then (losses[1]) + (open - close) else 0;
def upt = Sum(gains, length);
def dnt = Sum(losses, length);

plot imi_essf = if applySmoothing then EhlersSuperSmootherFilter(100 * (upt / (upt + dnt)), lowBand) else 100 * (upt / (upt + dnt));
imi_essf.SetDefaultColor(Color.GREEN);
imi_essf.SetLineWeight(2);

def basisx = ExpAverage(imi_essf, lengthBB);
def devx = (mult * StDev(imi_essf, lengthBB));
def ulx = (basisx + devx);
def llx = (basisx - devx);

input over_bought = 70;
plot ob = over_bought;
ob.SetDefaultColor(Color.DARK_RED);
ob.SetStyle(Curve.FIRM);
ob.HideTitle();

input over_sold = 20;
plot os = over_sold;
os.SetDefaultColor(Color.DARK_GREEN);
os.SetStyle(Curve.FIRM);
os.HideTitle();

plot imi_ob = if imi_essf >= ulx then imi_essf else Double.NaN;
imi_ob.SetDefaultColor(Color.YELLOW);
imi_ob.SetLineWeight(3);
imi_ob.SetStyle(Curve.POINTS);
imi_ob.HideTitle();

plot imi_midline = (ob + os) / 2;
imi_midline.SetDefaultColor(Color.ORANGE);
imi_midline.SetLineWeight(1);
imi_midline.SetStyle(Curve.SHORT_DASH);
imi_midline.HideTitle();

plot imi_os = if imi_essf <= llx then imi_essf else Double.NaN;
imi_os.SetDefaultColor(Color.YELLOW);
imi_os.SetLineWeight(3);
imi_os.SetStyle(Curve.POINTS);
imi_os.HideTitle();

plot imi_average = ExpAverage(imi_essf, lengthMA);
imi_average.SetDefaultColor(Color.RED);
imi_average.SetLineWeight(2);

AddCloud(imi_essf, imi_average, Color.GREEN, Color.RED);

AddCloud(0, os, Color.DARK_GREEN, Color.DARK_GREEN);
AddCloud(ob, 100, Color.DARK_RED, Color.DARK_RED);

Good Luck and Good Trading :)
 
Last edited:

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Well done with all the recent conversions. Keep it up!
 

HighBredCloud

Well-known member
Yeah...that was what was specified in the original LazyBear TradingView code...

obLevel=input(70, "IMI static OB level")
osLevel=input(20, "IMI static OS level")
@netarchitech very interesting...I like to read about the theory behind it...I've seen 65 35 and read what that's a better RSI setting but never seen this before. I had it up shortly but looks like my ON Demand is lagging...I like the smoothness of it for a momentum type indicator.
 

TDowns34

New member
@netarchitech Hi - I downloaded this study over the weekend and really like what I see so far. I've tried to back test it by looking at a few dozen prior charts and the volatility based OB/OS (yellow dot) indicators look to be very useful. Question: do you know if or how much of a lag there is on the yellow dots? Are they near real time or back filled after a several candle delay? (sorry if this is a noob question).
Thank you!
 

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.
Top