Smart Money Index (SMI) Indicator for ThinkorSwim


Hi friends! I'm learning to script and wanted to create a script that I think might be useful, however I can't seem to find anywhere for TOS.

It's a SMI aka Smart Money Index ( popularized by Bloomberg.

I'm not looking for someone to do it for me, although that would be fine too as I could study it and backwards engineer it to learn.

I'm also looking for any indicators similar to an SMI or any TOS scans that might be useful like block trades, dark pools and unusual options. AFAIK thinkorswim should be capable of these things, correct? Look forward to interacting with all of you here!

# TD Ameritrade IP Company, Inc. (c) 2007-2018

declare lower;

input over_Sold = 20;
input over_Bought = 80;

input length = 14;
input movingAvgLength = 1;

plot MoneyFlowIndex = Average(moneyflow(high, close, low, volume, length), movingAvgLength);
plot OverBought = over_Bought;
plot OverSold = over_Sold;

MoneyFlowIndex.DefineColor("OverBought", GetColor(5));
MoneyFlowIndex.DefineColor("Normal", GetColor(7));
MoneyFlowIndex.DefineColor("OverSold", GetColor(1));
MoneyFlowIndex.AssignValueColor(if MoneyFlowIndex > over_Bought then MoneyFlowIndex.color("OverBought") else if MoneyFlowIndex > over_Sold then MoneyFlowIndex.color("Normal") else MoneyFlowIndex.color("OverSold"));

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

Thank you. I’m looking more for finding that data within TOS :)

I’m surprised nobody has made an SMI yet. Do you know anyone with this script/indicator or a good fellow in these parts to help build it?
I don’t think this is possible mostly because the data required isn’t being provided by ThinkorSwim. I could be wrong.

@spm009 You can tag someone by placing “@“ in front of the name.
Since the 2000 stock market top, the Smart Money Index has failed to keep pace with the major stock indexes (see Chart 1), while the two components of the Index have come to the forefront as useful indicators of market-direction. At the early 2003 market low, the cumulative change in the DJIA during the first half-hour of trading (we call this the EMC – Early Market Component) has been correctly calling the shots in market direction (see Chart 2), while the LMC, the Late Market Component (final hour change in DJIA), has helped with short term secondary trends.
@horserider What would be ideal would be both charted in a single indicator.

The regular SMI (end of day) is still widely used by traders who have access to Bloomberg terminals and banks. See this article for example:

Yes and this looks like the correct formula, its not a crazy indicator to make I think.

// Original script by HPotter
// MA50 added by:  Scilentor
// Edit: 7.7.2019
study(title="Smart Money Index (50)", shorttitle="SMI(50)")
xcloseH1 = security(tickerid, "60", close)
xopenH1 =  security(tickerid, "60", open)
nRes = nz(nRes[1], 1) - (open - close) + (xopenH1 - xcloseH1)
length1 = input(50, "MA_Len")
plot(nRes, color=green, linewidth=2, title="SMI")
plot(sma(nRes,length1), color=yellow, linewidth=1, title="MA50")

Hi @RobertPayne ... I'm learning to code and we would be interested with your help if you can guide us with the SMI indicator in this thread. Ideally would be great if we could have two lines (EMC – Early Market Component & LMC - Late Market Component).
Last edited:
Here is the Smart Money Index indicator I converted to ThinkorSwim. Check it out.


#Smart Money Index (50) - SMI(50)

#2019.11.02 @diazlaz Initial Port

declare lower;

input AggPeriod = AggregationPeriod.HOUR;
input length1  = 50; #MA_Len

def xcloseH1 = close(period = AggPeriod);
def xopenH1  = open(period = AggPeriod);
def nRes = CompoundValue(1, nRes[1] - (open - close) + (xopenH1 - xcloseH1), 1);

plot pSMI = nRes;

plot pMA50 = Average(nRes, length1);
Last edited by a moderator:
@diazlaz You are so awesome haha! Was this hard to make? I want to learn to do this on my own.

Edit: I just plugged it in and not getting anything for some reason ... hmmm? Ah, ok it doesn't seem to work on longer time frames.

Here's some info on the Bloomberg version:

The Bloomberg Smart Money Flow Index is calculated by taking the action of the Dow in two time periods: the first 30 minutes and the close. The first 30 minutes represent emotional buying, driven by greed and fear of the crowd based on good and bad news. There is also a lot of buying on market orders and short covering at the opening. Smart money waits until the end and they very often test the market before by shorting heavily just to see how the market reacts. Then they move in the big way. These heavy hitters also have the best possible information available to them and they do have the edge on all the other market participants. To replicate this index, just start at any given day, subtract the price of the Dow at 10 AM from the previous day's close and add today's closing price. Whenever the Dow makes a high which is not confirmed by the SMFI there is trouble ahead.

What would be ideal would perhaps be to add both versions in one indicator (EMC – Early Market Component & LMC - Late Market Component) like @horserider mentioned :)
Last edited:
OK need some explanation. How is this following the SMI formula.
The basic formula for SMI is:
Today's SMI reading = yesterday's SMI – opening gain or loss + last hour change
For example, the SMI closed yesterday at 10000. During the first 30 minutes of today's trading, the Dow Jones has gained a total of 100 points. During the final hour, the Dow Jones has lost 80 points. So, today's SMI is 10000 – 100 + -80 = 9820.

Looks like a good translation of the TV study but how does that one follow the formula?
Where is yesterday's SMI considered?
What about first 30 min ? And last hour?

If someone can explain please.
@horserider I still strongly believe that this still isn't the true Smart Money Index as it does not follow the original formula (I don't even know if the formula on the Wikipedia page is even it). Somebody on TradingView also pointed this out as well.

Nothing wrong with the conversion (thanks @diazlaz for your work), but that's not the SMI indicator that @spm009 is requesting.

Edit: Here is another version of SMI for Ninja Trader.
thanks everyone, I coded it up from a formula prospective it looked interesting and didn't take a lot of cycles. I quickly eye the c# on ninja version, it looks close, similar formula structure, however I didn't go deep into it.

if anyone finds edge on it please let us know ;)
I'm going to try look into these, but my coding experience is kind of weak because I'm a newbie... Hopefully we can tweak these can make it into a great indicator. @horserider How do you think we can incorporate LMC and EMC into this study? Seems like we're almost there.

@diazlaz So I think I gave the wrong link previously... this seems to be the correct link for the SMI study on TV. The one you worked off of seems to be a backtest.

For some reason the study seems to be inverted when graphed, but most cases I've seen it, it runs parallel with SPX or DJI, but I have seen a few where it's inverted. I'm going to include some photos for reference:



My coding skills are limited, but I examined the TV code and the Ninja code and they seem similar. I think we are on the right track here.

The best version of this indicator would include EMC (dumb money) and LMC (smart money) like @horserider mentioned to compare along with a DJI or SPX graph superimposed to compare.
@diazlaz Looks like you not only made a way to bring it to TOS but you also improved it significantly along the way by adding a moving average that is adjustable and by adding a feature that allows you to change the timeframe of the SMI from an hour to a year, which is brilliant. Is there anyway you could create what you have made for TOS for TradingView? THAT would be most kind and helpful if you could. Or point me in the right direction to do so. Looking at the 3 day and the weekly SMI has been super helpful. Thanks
This is a great indicator, thank you for sharing. I plotted signals when it crosses and you'll notice it repaints, do you know how to fix it ?

#Smart Money Index (50) - SMI(50)

#If you put an 8 EMA signals will repaint more often

#2019.11.02 @diazlaz Initial Port

declare lower;

input AggPeriod = AggregationPeriod.HOUR;
input pma1  = 50; #MA_Len

def xcloseH1 = close(period = AggPeriod);
def xopenH1  = open(period = AggPeriod);
def nRes = CompoundValue(1, nRes[1] - (open - close) + (xopenH1 - xcloseH1), 1);

plot pSMI = nRes;

plot pMA50 = Average(nRes, pma1);

PSMI.AssignValueColor(if pSMI > pma50 then Color.Red else Color.Green);

plot UpSignal = if pSMI crosses below pma50 then pma50 else Double.NaN;
plot DownSignal = if psMI crosses above pma50 then pma50 else Double.NaN;
Has anybody actually had the chance to glance at MapSignals Big Money Index? I've followed the blog for a while now and they typically have some pretty interesting things to say. Yes, I know there are lots of "smart money" indicators, but I haven't seen anything that seems to match up with theirs.

I'd love to see if we can get a big money index copycat going at least, but they haven't really revealed much about where they get their inputs or calculations in the public posts.

Any ideas?


Sell index:

SCANZ (Equityfeed) has a tool called Moneyflow = Net Inflow (+)Uptick (-)Downtick Tracker expressed in Dollars.


Does TOS track and log the necessary data to create this custom indicator? If yes, any help towards generating a script is greatly appreciated.
The Smart Money Index (SMI) is calculated as:

Today's SMI = Yesterdays SMI - (gain/loss in 1st 30mins today) + (gain/loss on last 30 mins today)

The part that I'm having a tough time coming up with is calculating those gains/losses in the first and last 30 mins. I think I've got the open and close here:

def yAMOpen = open(period = AggregationPeriod.DAY);
def yPMClose = close(period = AggregationPeriod.DAY);;

I'm just missing the close at the end of the first thirty minutes and the open at the beginning of the last 30 minutes of the day yesterday. Can anyone clarify how I can define these variable so I can configure my formula?

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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