Market Phases Indicator for ThinkorSwim

@RonRay Could be that they have not fully fixed the issue yet. I would wait another day or so. You can use the input option to load up the link within your ToS.
 
Hi can anyone send my the txt file for the watchlist column for some reason the share link isn't working for me.
 
@Lukhy11 What was the problem? I didn't have any issue loading it. Perhaps you're having trouble pulling it up from ThinkorSwim. It's under Watchlist > Customize > Custom Quotes.
 
Hi Ben when I try to open the share link in thinkorswim I get a dialogue saying I have more than 100 custom quote, then thinkorswim asks me to replace it with another custom quote so I select an old one but thinkorswim doesn't seem to replace the old one with the new market phase quote it still shows the old quote for some reason. So I thought I would manual replace the old quote with the new Market Phase txt script.
 
Shared links once opened can send the code to various places - Studies, Strategies, MarketWatch, Scans, etc
Take some time to learn the differences betwen these different entities and you'll navigate through the system with ease
The only time when opening links was about a week ago when TOS had some system update that prevented us from doing so
 
@Lukhy11 That's a lot of custom quotes you got there. Try deleting some that you don't use or need and import the market phases again.
 
@BenTen That is the exact problem with studies being imported as Watchlist Columns, once imported, they literally cannot be deleted. There is absolutely no way to delete them. My solution to clean this up is simple, just rename all these extraneous Watchlist Column studies as Custom18, Custom19, Ciustom20, Custom21, etc.

Then when you need to implement a Watchlist column, just use the last one from this series. In my case the last one I have is Custom28. I make it a point NEVER to import any Watchlist Column and thus that is sort of a workaround I found that works for me.
 
Question if I check the included hours how does that affect stocks I noticed with this update that futures have a reliable reading and when I test stocks it’s scrambled curious on the feed back, and was there a code for the charts that automatically updated the chart time frame ?


I figured it out if you have extended maket hours checked stocks and futures will have different readings
 
Hello Friends,

Could someone help me to convert this to a scanner? I should able to scan for Bull Pase, Accumulation Phase, Distribution Phase. Thanks..

================
SCRIPT STARTS HERE
==================

Code:
#Trend Advisor Market Phases;

#Credit to the Chuck Dukas for creating the system and for then author of the VolumeTrendLabels whose study was use to create this indicator. Ensure you set the correct aggregation period to then chart, this helps calculate the correct volume and price action.

def agg = getAggregationPeriod();
input vPeriod = AggregationPeriod.HOUR; #hint vPeriod: Enter the chart time you use here. Required to properly caluclate volume and price strength.

def O = open(period = vPeriod);
def H = high(period = vPeriod);
def C = close(period = vPeriod);
def L = low(period = vPeriod);
def V = volume(period = vPeriod);

def SV = V * (H - C) / (H - L);
def BV = V * (C - L) / (H - L);

# below determines if volume supports the move, adds conviction

AddLabel(yes, "Buyer Vol Strong ", if high > high[1] and low > low[1] and BV*1.05 > SV then Color.GREEN else color.black);

AddLabel(yes, "Seller Vol Strong", if high < high[1] and low < low[1] and SV*1.05 > BV then Color.MAGENTA else color.black);

# below determines if price supports the move

AddLabel(yes, "Price Strong ", if high > high[1] and high [1] > high[2] and low > low[1] and low[1] > low[2] then Color.GREEN else color.black);

AddLabel(yes, "Price Weak", if high < high[1] and high[1] < high[2] and low < low[1] and low[1] < low[2] then Color.MAGENTA else color.black);

declare upper;
input price = close;
input displace = 0;

input avglength = 10; #hint avgLength: Then exponential average length you want to use for your pullback entries.

def fastavg = 50;
def slowavg = 200;


plot fastsma = Average( price, fastavg);
fastsma.SetDefaultColor(Color.Green);

plot slowsma = Average(price, slowavg);
slowsma.SetDefaultColor(Color.Red);

# Bullish criteria define below

# Define criteria for Bullish Phase : close > 50 SMA, close > 200 SMA, 50 SMA > 200 SMA

def bullphase = fastsma > slowsma && price > fastsma && price > slowsma;

# Define criteria for Accumulation Phase : close > 50 SMA, close > 200 SMA, 50 SMA < 200 SMA

def accphase = fastsma < slowsma && price > fastsma && price > slowsma;

# Define criteria for Recovery Phase : close > 50 SMA, close < 200 SMA, 50 SMA < 200 SMA

def recphase = fastsma < slowsma && price < slowsma && price > fastsma;



# Bearish Criteria define below

# Define criteria for Bearish Phase : close < 50 SMA, close < 200 SMA, 50 SMA < 200 SMA

def bearphase = fastsma < slowsma && price < fastsma && price < slowsma;

# Define criteria for Distribution Phase : close < 50 SMA, close < 200 SMA, 50 SMA > 200 SMA

def distphase = fastsma > slowsma && price < fastsma && price < slowsma;

# Define criteria for Warning Phase : close < 50 SMA, close > 200 SMA, 50 SMA > 200 SMA

def warnphase = fastsma > slowsma && price > slowsma && price < fastsma;


# Below conditions are for a possible entry when price touches the fastema

#def pbavg = MovingAverage(Average, price, avglength);

def pbavg = ExpAverage(data = price[-displace], length = avglength);

input bullpullback = yes;  #hint bullpullback: Do you want to display the pullback arrows for bullish fast ema entries.
input bearpullback = yes; #hint bearpullback: Do you want to display the pullback arrows for bearish fast ema entries.

def bullishpb = low < pbavg && open > pbavg;
def bearishpb = high > pbavg && open < pbavg;

def bullpb = bullphase is true && bullishpb is true;
def bearpb = bearphase is true && bearishpb is true;

# Plot Signals
plot bullpb1 = if bullpullback then bullpb else 0;
bullpb1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullpb1.SetDefaultColor(Color.CYAN);
bullpb1.SetLineWeight(1);

plot bearpb1 = if bearpullback then bearpb else 0;
bearpb1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearpb1.SetDefaultColor(Color.red);
bearpb1.SetLineWeight(1);



#plot buphase = bullphase is true;
#plot acphase = accphase is true;
#plot rephase = recphase is true;

#plot bephase = bearphase is true;
#plot dphase = distphase is true;
#plot wphase = warnphase is true;


# Below adds labels to the chart to identify what phase the underlying is in


AddLabel(bullphase, " Bull Phase" , if bullphase is true then Color.GREEN else Color.BLACK);

AddLabel(accphase, " Accumation Phase ", if accphase is true then Color.lIGHT_GREEN else Color.BLACK);

AddLabel(recphase, " Recovery Phase ", if recphase is true then Color.lIGHT_ORANGE else Color.BLACK);

AddLabel(warnphase, " Warning Phase ", if warnphase is true then Color.orANGE else Color.BLACK);

AddLabel(distphase, " Distribution Phase ", if distphase is true then Color.light_red else Color.BLACK);

AddLabel(bearphase, " Bear Phase ", if bearphase is true then Color.red else Color.BLACK);


assignPriceColor(if bullphase then Color.GREEN else if bearphase then Color.RED else Color.orange);

================
SCRIPT ENDS HERE
==================
 
Last edited by a moderator:
Here is the scan for what you asked for. It could be possible for other scans like the first bar where the phase changes or whatever.

https://tos.mx/OEdzynY
Edit the scan and change the Plot Scan = to whichever phase you want to scan for.
 
Last edited:
I also made a couple changes to the indicator. Made it a lower study with different color dot for each phase for testing purposes.

https://tos.mx/456GR0p

Bull Phase is Green Dot

Accumulation is Light Green Dot

Recovery is Light Orange Dot

Warning is Orange Dot

Distribution is Pink Dot

Bear Phase is Red Dot
 

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
480 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