Intraday Intensity Index for ThinkorSwim


Staff member
A volume based indicator that depicts the flow of funds for a security according to where it closes in its high and low range.

This indicator was developed by Dave Bostian. Its goal is to track the activity of institutional block traders.

A technical indicator that approximates the volume of trading for a specified security in a given day. It is designed to help track the activity of institutional block traders and is calculated by subtracting the day's high and low from double the closing price, divided by the volume and multiplied by the difference between the high and the low.

John BOLLINGER advised to use this indicator as a confirmation tool with the BOLLINGER BANDS .

If price tags the lower BBand, look for IIIX has positive values to enter a trade. Conversely; If price tags the upper BBand, look for IIIX has negative values to exit.


# Intraday Intensity Index
# Assembled by BenTen at
# Converted from

declare lower;

input length = 21;
def K1 = (2 * close - high - low) * volume;
def K2 = if(high != low, high - low, 1);
def INT = K1 / K2;
def INTSUM = sum(INT, length);

plot histogram = INTSUM;
plot a = INT;

histogram.AssignValueColor(if INTSUM>0 then else;
Inteeeerrresting. Gonna have to play around with this one. Haven't had as much time to experiment in a while.

Author message:
Intraday Intensity Index was created by David Bostian and its use was later featured by John Bollinger in his book "Bollinger on Bollinger Bands". It is categorically a volume indicator and considered to be a useful tool for analyzing supply and demand dynamics in the market. By measuring the level of buying and selling pressure within a given trading session it attempts to provide insights into the strength of market participants' interest and their aggressiveness in executing trades throughout the day. It can be used in conjunction with Bollinger Bands® or other envelope type indicators as a complimentary indicator to aid in trying to identify potential turning points or trends.

#// This source code is subject to the terms of the Mozilla Public License 2.0 at
#// © allanster on TradingView
# 'concept. Whenever this setting is enabled the indicator should be regarded as operating in an experimental mode.'
#// Original concept by David Bostian, with variations featured in "Bollinger on Bollinger Bands".
#indicator("Intraday Intensity Modes", 'Intensity')
# converted by Sam4Cok@Samer     - 06/2023
declare lower;
input ColorBars  = yes;
input OscLength  = 21;          # 'Osc Length'
input Cumulative = no;          # 'Cumulative'
input Normalized = yes;         # 'Normalized'
input Intrabar   = no;          # 'Intrabar'
input chartStyle = {default Columns, Histogram, Line};    # 'Style & Width'
input ShowLevels = yes;
input ShowLevelAbove  = 25;     # 'Show Levels Above'
input ShowLevelBelow  = -25;    # 'Below'

def na = Double.NaN;
def last = isNaN(Close);
def i_length = OscLength;
def Columns = chartStyle==chartStyle.Columns;
def Histogram = chartStyle==chartStyle.Histogram;

#id_cum(source) => // perform cumulative sum once per day when using realtime intraday source values
script id_cum {
    input source = close;
    def current = GetAggregationPeriod();
    def isintraday = current < AggregationPeriod.DAY;
    def startDay  = GetYYYYMMDD() - GetYYYYMMDD()[1];
    def carrySum;
    def dailySum;
    if isintraday {
        dailySum = CompoundValue(1, if startDay then carrySum[1] else dailySum[1], source[1]);
        carrySum = dailySum + source;
    } else {
        dailySum = Double.NaN;
        carrySum = CompoundValue(1,carrySum[1] + source, source);
    plot out = if carrySum==0 then Double.NaN else carrySum;
#altSum(source, length)
script altSum {
    input source = close;
    input length = 21;
    def normal = Sum(if(isNaN(source),0,source), length);# // treat na as 0 and return sum
    plot out = normal;

def startDay  = GetYYYYMMDD() - GetYYYYMMDD()[1];
def current = GetAggregationPeriod();
def isintraday = current < AggregationPeriod.DAY;
def idRangeH;def idRangeL;def idVolume;

def idH = if idRangeH[1]==0 then high[1] else idRangeH[1];
    idRangeH = if (!isintraday or startDay) then high else
               if high > idH then high else idH;# // intraday high
def idL = if idRangeL[1]==0 then low[1] else idRangeL[1];
    idRangeL = if (!isintraday or startDay) then low else
               if low < idL then low else idL;# // intraday low
def idVol = if idVolume[1]==0 then volume else idVolume[1];
    idVolume = if (!isintraday or startDay) then volume else idVol + volume;

def iiValue =  ((2 * close - idRangeH - idRangeL) / (idRangeH - idRangeL)) * idVolume;    # // intraday intensity
def iiiValue = if isNaN(iiValue) then 0 else iiValue;

def iii = ((2 * close - high - low) / (high - low)) * volume;
def TotVol    = CompoundValue(1, TotVol[1] + volume, volume);
def TotSumiii = (CompoundValue(1, TotSumiii[1] + iii, iii));
def cumiii    = id_cum(iiiValue);
def cumVol    = id_cum(idVolume);
def Sumii1    = if Cumulative then if Intrabar then TotSumiii else cumiii else if Intrabar then iii else iiiValue;
def Sumii2    = if Cumulative then if Intrabar then TotVol else cumVol else
                if Intrabar then volume else idVolume;
def usePrcnt = if  Normalized then 100 else 1;

def iiSource =  usePrcnt * altSum(Sumii1, i_length) / (if Normalized then altSum(Sumii2, i_length) else 1);

def colrSign = altSum(if Intrabar then iii else iiiValue, i_length) /
                     (if Normalized then if Intrabar then volume else altSum(idVolume, i_length) else 1);

def upCandle = sign(colrSign) != -1;
plot Intensity = if last then na else iiSource;
Intensity.SetPaintingStrategy(if Histogram then PaintingStrategy.HISTOGRAM else
                              if Columns then PaintingStrategy.SQUARED_HISTOGRAM else PaintingStrategy.LINE);
Intensity.AssignValueColor(if upCandle then Color.CYAN else Color.MAGENTA);

plot hline = if last or !ShowLevels then na else ShowLevelAbove;
plot lline = if last or !ShowLevels then na else
             if Cumulative then 0 else ShowLevelBelow;

AssignPriceColor(if !ColorBars then Color.CURRENT else if upCandle then
                 if iiSource>iiSource[1] then Color.GREEN else Color.DARK_GREEN else
                 if iiSource<iiSource[1] then Color.RED else Color.DARK_RED);
#// Reference Equations Used
#// III = ((2 * close) - high - low) / ((high - low) * volume)

#--- END of CODE

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