Possible Accumulation Day Indicator for ThinkorSwim

BenTen

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

ZbsL3Jl.png


thinkScript Code
Rich (BB code):
#
# Copyright 2017 Scott J. Johnson (http://scottjjohnson.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# 
# 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);

Shareable Link
https://tos.mx/0OuaU9

Credit:

 
Last edited:

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