Bull Flag and Bear Flag Formations for ThinkorSwim

lol yes I am a fan of his work . Im a fan of your work as well because of you I able to use the scan. Cant thank you enough.
 
@Buckbull You lost me , I understand to do a Bear Flag I take out the Bull flag script stuff but not really sure how much of the script I take out? Sorry
 
@Buckbull There is no need to remove anything. Take a look at the last portion of the script @tomsk provided. Follow the instruction in there as well.

Code:
# Delete (#) the plot not needed

plot Bulltrigger = trend and MacdLow and trigATR and PriceSma;
# plot BearTrigger = TrendBear and MacdHighBear and BtrigATR and BPriceSma ;

The snippet above will scan for bull flag signals. Now, if you want to scan for bear flags, then add "#" in front of plot Bulltrigger and remove the # sign from the plot BearTrigger.
 
@daredevilxv5 It's under Watchlist > Customize > Custom Quotes. Select one of the option in there and paste the code in. Also, be sure to adjust the timeframe.
 
I just added both code to my watchlist and they don’t match. I am not coder but are the parameters different for each code?

VN0KrVc.jpg


@BenTen
 
Last edited by a moderator:
For fans of pure price action patterns. This indicator helps to identify and spot potential wedge patterns on your chart. This was put together by @korygill.

PQR2Xcu.png

6X9mhtS.png


The yellow arrows (up and down) suggested that there is a potential wedge pattern within the last 4 bars (including the candle with the arrows). White arrows (which are rare suggest there may be a wedge pattern within the last 5 bars). You can easily use this indicator with the scanner.

thinkScript Code

Code:
# Price Action Wedge Patterns
# Include Four and Five Bar Wedges
# Developed based on idea from BenTen of useThinkScript.com
# Study to indicate when a wedge may be forming.
# Author: Kory Gill, @korygill
# Version 1.0

declare upper;
declare once_per_bar;

input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);

def vHigh = high;
def vLow = low;
def nan = Double.NaN;

def range = vHigh - vLow;
def isInsideBar = if range < range[1] and vHigh < vHigh[1] and vLow > vLow[1]
                  then 1
                  else 0;

# Define 4 Bars Wedge
def FourBarsWedges = high < high[3] and high[0] < high[3] and high[1] < high[3] and high[2] < high[3] and
low > low[3] and low[0] > low[3] and low[1] > low[3] and low[2] > low[3];
plot up4 = FourBarsWedges;
plot down4 = FourBarsWedges;
up4.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
up4.SetLineWeight(1);
up4.AssignValueColor(Color.Yellow);
down4.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
down4.SetLineWeight(1);
down4.AssignValueColor(Color.Yellow);

# Define 5 Bars Wedge
def FiveBarsWedges = high < high[4] and high[1] < high[4] and high[2] < high[4] and high[3] < high[4] and
low > low[4] and low[1] > low[4] and low[2] > low[4] and low[3] > low[4];
plot up5 = FiveBarsWedges;
plot down5 = FiveBarsWedges;
up5.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
up5.SetLineWeight(1);
up5.AssignValueColor(Color.WHITE);
down5.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
down5.SetLineWeight(1);
down5.AssignValueColor(Color.WHITE);
 
Last edited:
Will this chart actually show the lines like that or just the arrows? I just installed it and I see neither. Actually I do see the arrows but its from 10 days back. Thanks!
 
ben
def FiveBarsWedges = high < high[4] and high[1] < high[4] and high[2] < high[4] and high[3] < high[4] and
low > low[4] and low[1] > low[4] and low[2] > low[4] and low[3] > low[4];
plot up5 = FourBarsWedges;
plot down5 = FourBarsWedges;


Is this correct plot up5 = fourbarswedge. should it not be fivebarwedge
 

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