StratBar Watchlist Column RTH & PreMarket For ThinkOrSwim

Mr D

New member
Displays previous two bars with trend strength marks.

mMVhRaAKZknQ.png


Ruby:
###########################################################################
# StratBar WL Column Pre Market                                           #
# Displays previous two stratbars with direction and trend strength marks #
###########################################################################

script stratBar1 {
# Generation time: 2021-07-03T01:59:10.800428800Z

def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot = 
    ((Sum(IsUp, 1)[1] >= 0)) and
    ((Sum(IsUp, 1)[0] >= 0)) and
    Highest(high[1], 1) >= Highest(high[0], 1) and
    Lowest(low[1], 1) <= Lowest(low[0], 1);
}
script stratbar2d {
# Generation time: 2021-07-03T02:29:53.784750700Z

def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot = 
    ((Sum(IsUp, 1)[1] >= 0)) and
    ((Sum(IsUp, 1)[0] >= 0)) and
    Highest(high[1], 1) >= Highest(high[0], 1) and
    Lowest(low[1], 1) > Lowest(low[0], 1);

}
script stratbar2u {
# Generation time: 2021-07-03T02:30:15.393547900Z

def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot = 
    ((Sum(IsUp, 1)[1] >= 0)) and
    ((Sum(IsUp, 1)[0] >= 0)) and
    Lowest(low[1], 1) <= Lowest(low[0], 1) and
    Highest(high[1], 1) < Highest(high[0], 1);

}
def top = low + 0.764*(high-low);
def bot = low + 0.234*(high-low);

addlabel(yes,concat(if stratBar1()[0] then "1" 
else if stratbar1()[1] then if stratbar2u()[0] then "12u" else if stratbar2d()[0] then "12d" else "13" 
else if stratbar2u()[1] then if stratbar2u()[0] then "2u2u" else if stratbar2d()[0] then "2u2d" else "2u3" 
else if stratbar2d()[1] then if stratbar2u()[0] then "2d2u" else if stratbar2d()[0] then "2d2d" else "2d3" 
else if stratbar2u()[0] then "32u" else if stratbar2d()[0] then "32d" else "33" ,
if close[0]>top[0] then "++" else if close[0]<bot[0] then "--"  else if close[0]>open[0] then "+" else if close[0]<open[0] then "-" else " "));
assignBackgroundColor(if close[0]<bot[0] then color.dark_red else if close[0]>top[0] then color.dark_green else color.black);

#######
# END #
#######
 
Last edited:
g19gAmOEiF9e.png


Ruby:
###########################################################################
# StratBar WL Column After Market Open                                    #
# Displays previous two stratbars with trend direction and strength marks #
###########################################################################

script stratBar1 {
# Generation time: 2021-07-03T01:59:10.800428800Z

def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot =
    ((Sum(IsUp, 1)[1] >= 0)) and
    ((Sum(IsUp, 1)[0] >= 0)) and
    Highest(high[1], 1) >= Highest(high[0], 1) and
    Lowest(low[1], 1) <= Lowest(low[0], 1);
}
script stratbar2d {
# Generation time: 2021-07-03T02:29:53.784750700Z

def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot =
    ((Sum(IsUp, 1)[1] >= 0)) and
    ((Sum(IsUp, 1)[0] >= 0)) and
    Highest(high[1], 1) >= Highest(high[0], 1) and
    Lowest(low[1], 1) > Lowest(low[0], 1);

}
script stratbar2u {
# Generation time: 2021-07-03T02:30:15.393547900Z

def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot =
    ((Sum(IsUp, 1)[1] >= 0)) and
    ((Sum(IsUp, 1)[0] >= 0)) and
    Lowest(low[1], 1) <= Lowest(low[0], 1) and
    Highest(high[1], 1) < Highest(high[0], 1);
}
def top = low + 0.764*(high-low);
def bot = low + 0.234*(high-low);

addlabel(yes,concat(if stratBar1()[1] then "1"
else if stratbar1()[2] then if stratbar2u()[1] then "12u" else if stratbar2d()[1] then "12d" else "13"
else if stratbar2u()[2] then if stratbar2u()[1] then "2u2u" else if stratbar2d()[1] then "2u2d" else "2u3"
else if stratbar2d()[2] then if stratbar2u()[1] then "2d2u" else if stratbar2d()[1] then "2d2d" else "2d3"
else if stratbar2u()[1] then "32u" else if stratbar2d()[1] then "32d" else "33" ,
if close[1]>top[1] then "++" else if close[1]<bot[1] then "--"  else if close[1]>open[1] then "+" else if close[1]<open[1] then "-" else " "));
assignBackgroundColor(if close[1]<bot[1] then color.dark_red else if close[1]>top[1] then color.dark_green else color.black);

#######
# END #
#######
 

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