# Possible Accumulation Day Indicator for ThinkorSwim

#### BenTen

Staff member
Staff
VIP
Knowing the accumulation and distribution levels can help to measures supply and demand of the stock. When looking at whether a stock is being accumulated or distributed, we use volume and where price closed within the period's range.

The author noted that ThinkorSwim "doesn't have COMP volume" so take that into consideration.

thinkScript Code
Rich (BB code):
``````#
# Copyright 2017 Scott J. Johnson (http://scottjjohnson.com)
#
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
#

#
# PossibleAccumulationDayIndicator
#
# Adds an indicator on the chart when the price gain is greater than the
# minimum necessary for an Accumulation Day per Market School rules. This
# is a "possible" AD because Market School also requires volume to be greater
# than the prior day, but TOS doesn't have COMP volume so that portion of the
# rule must be applied manually.
#
#declare upper;
input Period = 200;

def Up = If(close > close[1], (close - close[1])/close*100, 0);
def Count = If(close > close[1], 1, 0);

def UpTotalGain = Sum(Up, Period);
def UpTotalDays = Sum(Count, Period);
def AvgGainPct = UpTotalGain/UpTotalDays;

def AccumulationDayMinPctGain;

if (AvgGainPct < 0.4) {
AccumulationDayMinPctGain = 0.7;
} else if (AvgGainPct >= 0.4 and AvgGainPct < 0.55) {
AccumulationDayMinPctGain = 0.85;
} else if (AvgGainPct >= 0.55 and AvgGainPct < 1.0) {
AccumulationDayMinPctGain = 1.0;
} else if (AvgGainPct >= 1.0) {
AccumulationDayMinPctGain = 1.245;
} else {
AccumulationDayMinPctGain = Double.NAN;
}

plot AccumulationDay = (Up >= AccumulationDayMinPctGain);
AccumulationDay.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
AccumulationDay.SetDefaultColor(Color.GREEN);``````

https://tos.mx/0OuaU9

Credit:

Last edited:

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