Bull Flag Scan

bobhobe

New member
Please review the AI-generated scan below and suggest improvements.

jaZy1Fm.png


Code:
# Flag Pattern Scan
input flagpoleLength = 10; # Length of the flagpole (sharp move)
input consolidationLength = 5; # Length of the consolidation (flag)
input volumeDropThreshold = 0.7; # Volume drop threshold during consolidation (e.g., 70% of average volume)
input priceRetracementThreshold = 0.3; # Maximum retracement during consolidation (e.g., 30% of flagpole move)

# Calculate flagpole move
def flagpoleHigh = Highest(high, flagpoleLength);
def flagpoleLow = Lowest(low, flagpoleLength);
def flagpoleMove = if close[flagpoleLength] < close then flagpoleHigh - flagpoleLow else flagpoleLow - flagpoleHigh;

# Consolidation range
def consolidationHigh = Highest(high, consolidationLength);
def consolidationLow = Lowest(low, consolidationLength);
def consolidationRange = consolidationHigh - consolidationLow;

# Volume during consolidation
def avgVolume = Average(volume, consolidationLength);
def isVolumeDrop = volume < avgVolume * volumeDropThreshold;

# Price retracement during consolidation
def retracementRatio = consolidationRange / flagpoleMove;
def isRetracementValid = retracementRatio <= priceRetracementThreshold;

# Flag pattern condition
def isFlagPattern = isVolumeDrop and isRetracementValid;

# Plot or scan for flag patterns
plot FlagPattern = isFlagPattern;
FlagPattern.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
FlagPattern.SetDefaultColor(Color.GREEN);

Please review the AI-generated scan below and suggest improvements.

jaZy1Fm.png


Code:
# Flag Pattern Scan
input flagpoleLength = 10; # Length of the flagpole (sharp move)
input consolidationLength = 5; # Length of the consolidation (flag)
input volumeDropThreshold = 0.7; # Volume drop threshold during consolidation (e.g., 70% of average volume)
input priceRetracementThreshold = 0.3; # Maximum retracement during consolidation (e.g., 30% of flagpole move)

# Calculate flagpole move
def flagpoleHigh = Highest(high, flagpoleLength);
def flagpoleLow = Lowest(low, flagpoleLength);
def flagpoleMove = if close[flagpoleLength] < close then flagpoleHigh - flagpoleLow else flagpoleLow - flagpoleHigh;

# Consolidation range
def consolidationHigh = Highest(high, consolidationLength);
def consolidationLow = Lowest(low, consolidationLength);
def consolidationRange = consolidationHigh - consolidationLow;

# Volume during consolidation
def avgVolume = Average(volume, consolidationLength);
def isVolumeDrop = volume < avgVolume * volumeDropThreshold;

# Price retracement during consolidation
def retracementRatio = consolidationRange / flagpoleMove;
def isRetracementValid = retracementRatio <= priceRetracementThreshold;

# Flag pattern condition
def isFlagPattern = isVolumeDrop and isRetracementValid;

# Plot or scan for flag patterns
plot FlagPattern = isFlagPattern;
FlagPattern.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
FlagPattern.SetDefaultColor(Color.GREEN);
Nobody willing to help with this?
 
Last edited by a moderator:
Solution
Please review the AI-generated scan below and suggest improvements.

Nobody willing to help with this?


Not sure what you want help with.

Yes, your script is identifying bull flag patterns.
Yes, candlestick patterns are random.

They only have meaning when they occur at significant points
IE: at support and resistance zones or overbought/oversold etc...

Candlestick pattern traders use price action and order flow to find trades and THEN use candlestick patterns to confirm.
https://usethinkscript.com/threads/price-action-toolbox-for-thinkorswim.10747/

You are scanning for trades from the bottom up.
You need to trade from the top down. Identify the market dynamics that define your trade, then review your chart for...
Please review the AI-generated scan below and suggest improvements.

Nobody willing to help with this?


Not sure what you want help with.

Yes, your script is identifying bull flag patterns.
Yes, candlestick patterns are random.

They only have meaning when they occur at significant points
IE: at support and resistance zones or overbought/oversold etc...

Candlestick pattern traders use price action and order flow to find trades and THEN use candlestick patterns to confirm.
https://usethinkscript.com/threads/price-action-toolbox-for-thinkorswim.10747/

You are scanning for trades from the bottom up.
You need to trade from the top down. Identify the market dynamics that define your trade, then review your chart for identifying candle patterns.
 
Last edited:
Solution

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