Smart Money Index (SMI) Indicator for ThinkorSwim

spm009

Member
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 (https://en.m.wikipedia.org/wiki/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!

Code:
#
# 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"));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));
 

spm009

Member
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?
 

BenTen

Administrative
Staff member
Staff
VIP
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.
 

horserider

Well-known member
VIP
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.
https://www.hertlermarketsignal.com/
 

spm009

Member
@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: https://www.cnbc.com/2019/01/14/the...omeback-in-force-classic-indicator-shows.html

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

Code:
////////////////////////////////////////////////////////////
// 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:

diazlaz

Well-known member
2019 Donor
VIP
Here is the Smart Money Index indicator I converted to ThinkorSwim. Check it out.

OLnsODa.png



Ruby:
#Smart Money Index (50) - SMI(50)
#
#CREDITS
#https://www.tradingview.com/script/YyNeevML-Smart-Money-Index-SMI-Backtest/
#https://www.tradingview.com/u/HPotter/

#CHANGELOG
#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;
pSMI.AssignValueColor(COLOR.LIME);
pSMI.SetLineWeight(2);

plot pMA50 = Average(nRes, length1);
pMA50.AssignValueColor(COLOR.YELLOW);
 
Last edited by a moderator:

spm009

Member
@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:

horserider

Well-known member
VIP
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.
 

BenTen

Administrative
Staff member
Staff
VIP
@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.
 

diazlaz

Well-known member
2019 Donor
VIP
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 ;)
 

spm009

Member
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. https://www.tradingview.com/script/PQEvcezt-Smart-Money-Index-SMI/

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:

524b3fa569bedd176940fdba


smartmoney.jpg


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.
 

jack

New member
VIP
@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
 

hectorgasm

Member
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 ?

Code:
#Smart Money Index (50) - SMI(50)
#
#CREDITS
#https://www.tradingview.com/script/YyNeevML-Smart-Money-Index-SMI-Backtest/
#https://www.tradingview.com/u/HPotter/


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



#CHANGELOG
#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);
pMA50.AssignValueColor(COLOR.cyan);


pSMI.SetLineWeight(2);
PSMI.SetDefaultColor(Color.Lime);
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;
 

wtf_dude

Active member
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?


BMI.png


Sell index:


TECH.png
 

SCALPER

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

j5LhdTV.png


Does TOS track and log the necessary data to create this custom indicator? If yes, any help towards generating a script is greatly appreciated.
 

jbmia

New member
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:

Code:
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

Top