Buy Condition with Support Detection via Swing Lows

Alex43

New member
Is there an example of a conditional order that utilizes support and resistance levels to trigger buy and sell actions?
I am not sure if the following would be a good one:

low[1] <= Lowest(low[2], 10) and close > close[1] and volume > Average(volume, 20)

(yesterday hit a swing low) and (today is bouncing upward) and today has above-average volume)
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Is there an example of a conditional order that utilizes support and resistance levels to trigger buy and sell actions?
I am not sure if the following would be a good one:

low[1] <= Lowest(low[2], 10) and close > close[1] and volume > Average(volume, 20)

(yesterday hit a swing low) and (today is bouncing upward) and today has above-average volume)
Here are 2 scanners 1) daily and 2) intraday to run the scan in the 5 or 15 minute timeframe
1) daily
Code:
# DAILY SWING-LOW BOUNCE WITH ABOVE-AVERAGE VOLUME
# Use as a Stock Hacker custom study filter by Alex43
# Set the scan aggregation to DAY
# ANTWERKS 08/18/2026

input swingLookback = 10;
input volumeLength = 20;
input useCompletedBarsOnly = yes;

Assert(swingLookback > 0, "swingLookback must be greater than 0");
Assert(volumeLength > 0, "volumeLength must be greater than 0");

# LIVE DAILY VERSION
# Yesterday made a new 10-session swing low. Today is trading above
# yesterday's close on volume running above its 20-session average.
def liveSignal =
    low[1] <= Lowest(low[2], swingLookback) and
    close > close[1] and
    volume > Average(volume, volumeLength);

# COMPLETED-DAY VERSION
# Two sessions ago made the swing low. Yesterday completed a bounce
# on above-average volume. This result remains stable during today.
def completedSignal =
    low[2] <= Lowest(low[3], swingLookback) and
    close[1] > close[2] and
    volume[1] > Average(volume, volumeLength)[1];

plot scan =
    if useCompletedBarsOnly
    then completedSignal
    else liveSignal;

2) Intraday
Code:
# INTRADAY SWING-LOW BOUNCE WITH ABOVE-AVERAGE VOLUME
# Use as a Stock Hacker custom study filter from Alex43
# Set the scan aggregation to 5 minutes or 15 minutes
# ANTWERKS 08/18/2026

input swingLookback = 10;
input volumeLength = 20;
input useCompletedBarsOnly = yes;

Assert(swingLookback > 0, "swingLookback must be greater than 0");
Assert(volumeLength > 0, "volumeLength must be greater than 0");

# LIVE VERSION
# Previous intraday candle made a new 10-bar swing low.
# Current developing candle is bouncing with above-average volume.
def liveSignal =
    low[1] <= Lowest(low[2], swingLookback) and
    close > close[1] and
    volume > Average(volume, volumeLength);

# COMPLETED-BAR VERSION
# Two bars ago made the swing low. The most recently completed candle
# bounced and finished with above-average volume. This prevents the
# scan result from flickering during the developing candle.
def completedSignal =
    low[2] <= Lowest(low[3], swingLookback) and
    close[1] > close[2] and
    volume[1] > Average(volume, volumeLength)[1];

plot scan =
    if useCompletedBarsOnly
    then completedSignal
    else liveSignal;

GOOD LUCK! (NOTE_ look to the "down stocks" for bounce canidates in the intraday)
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
798 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