Percent From High Dynamic Channel + Breakout System For ThinkOrSwim

uplink

New member
This ThinkorSwim script, called "Percent From High Dynamic Channel + Breakout System", is specifically designed for trading low-float stocks, where momentum moves are fast and sharp pullbacks are common. The script tracks how far the current price is from its recent high over a user-defined period (default is 100 bars), making it easier to spot breakout setups and healthy pullbacks. It offers two channel modes: Full (-10%) and Half (-5%), helping traders adjust sensitivity based on volatility. Candle colors shift dynamically: green highlights breakouts above the high, while yellow, orange, and dark green show controlled pullbacks into risk-managed entry zones. A red candle signals that price has fallen too far below trend and may be breaking down. This zone-based coloring is crucial when trading low floats, where timing is everything and chasing can lead to fast reversals. A shaded cloud visually fills the valid pullback area, helping confirm whether price action is still in play. A breakout dot appears when the price closes above the previous high—perfect for catching fresh momentum spikes. The VWAP line is included to help align entries with institutional volume support. This system is built to help low-float scalpers and intraday traders avoid emotional entries by showing whether price is still holding trend or pushing into exhaustion. When paired with volume surge indicators, it becomes a powerful tool for catching clean breakouts or pullback continuations without second-guessing.

I worked on this system for a while, it seems to work for me. This system works good on low float stocks.

Let me know if I need to add anything. I don't use HA candles on this system, I use Trend Candles.

Screenshot from 2025-07-14 11-15-36.png



Code:
#--------------------------------------------------------------
# Upper Study: Percent From High Dynamic Channel + Breakout System
# Author: Uplink
# Version: 1.2
# Date: [2025-07-01]
#
# Description:
# - Adds user toggle between Full Channel (0% to -10%)
#   and Half Channel (0% to -5%) for trend zone display.
# - Maintains consistent and modular candle painting logic.
#--------------------------------------------------------------

declare upper;

input length = 100;
input showCloud = yes;
input showBreakoutDot = yes;
input channelMode = {default "Full", "Half"};

# Highs and channel levels
def highestHigh = Highest(high, length);
def minus5 = highestHigh * 0.95;
def minus10 = highestHigh * 0.90;

plot HighLine = highestHigh;
HighLine.SetDefaultColor(Color.CYAN);
HighLine.SetLineWeight(2);

plot Minus5Line = minus5;
Minus5Line.SetDefaultColor(Color.BLUE);
Minus5Line.SetLineWeight(3);
Minus5Line.SetStyle(Curve.SHORT_DASH);

plot Minus10Line = minus10;
Minus10Line.SetDefaultColor(Color.RED);
Minus10Line.SetLineWeight(1);
Minus10Line.SetStyle(Curve.SHORT_DASH);

# Percent from high
def percentFromHigh = (close - highestHigh) / highestHigh;

# Threshold levels based on channel mode
def deepPullback = if channelMode == channelMode."Full" then -0.10 else -0.05;
def midPullback = -0.05;
def lightPullback = -0.02;

# Zone definitions
def breakoutZone  = percentFromHigh > 0;
def zone1         = percentFromHigh <= 0 and percentFromHigh > lightPullback;           # 0% to -2%
def zone2         = percentFromHigh <= lightPullback and percentFromHigh > midPullback; # -2% to -5%
def zone3         = percentFromHigh <= midPullback and percentFromHigh > deepPullback;  # -5% to -10%
def outsideRange  = percentFromHigh <= deepPullback;

# Candle coloring
AssignPriceColor(
    if breakoutZone then Color.LIME else
    if zone1 then Color.YELLOW else
    if zone2 then Color.ORANGE else
    if zone3 then Color.DARK_GREEN else
    Color.DARK_RED
);

# Cloud zones
def dynamicLow = if channelMode == channelMode."Full" then minus10 else minus5;
def priceBelowCutoff = percentFromHigh <= deepPullback;

AddCloud(
    if showCloud and !priceBelowCutoff then HighLine else Double.NaN,
    if showCloud and !priceBelowCutoff then dynamicLow else Double.NaN,
    Color.DARK_GREEN, Color.DARK_GREEN
);

AddCloud(
    if showCloud and priceBelowCutoff then HighLine else Double.NaN,
    if showCloud and priceBelowCutoff then dynamicLow else Double.NaN,
    Color.DARK_RED, Color.DARK_RED
);

# Breakout dot
def breakout = close > highestHigh[1];
plot BreakoutDot = if showBreakoutDot and breakout then high + (high * 0.01) else Double.NaN;
BreakoutDot.SetPaintingStrategy(PaintingStrategy.POINTS);
BreakoutDot.SetDefaultColor(Color.LIGHT_ORANGE);
BreakoutDot.SetLineWeight(3);

# Mid-line for Half Channel Mode (-2.5% level)
def midLevel = highestHigh * 0.975;
plot HalfChannelMidLine = if channelMode == channelMode."Half" then midLevel else Double.NaN;
HalfChannelMidLine.SetDefaultColor(Color.LIGHT_GRAY);
HalfChannelMidLine.SetStyle(Curve.SHORT_DASH);
HalfChannelMidLine.SetLineWeight(1);

# Label
AddLabel(yes, "From High (" + length + "): " + AsPercent(percentFromHigh),
    if percentFromHigh > 0 then Color.GREEN
    else if percentFromHigh > -0.02 then Color.YELLOW
    else if percentFromHigh > -0.10 then Color.RED
    else Color.LIGHT_RED);



AssignPriceColor(
    if breakoutZone then Color.LIME else
    if zone1 then Color.YELLOW else
    if zone2 then Color.ORANGE else
    if zone3 then Color.Dark_Green else
    Color.DARK_RED
);


# VWAP calculation for the current trading day
def vwap = reference VWAP();

plot VWAPPlot = vwap;
VWAPPlot.SetDefaultColor(Color.CYAN);
VWAPPlot.SetLineWeight(2);
VWAPPlot.SetPaintingStrategy(PaintingStrategy.LINE);

AddLabel(yes,
    if channelMode == channelMode."Full" then "Mode: Full Deplex (0% to -10%)"
    else "Mode: Half Deplex (0% to -5%)",
    if channelMode == channelMode."Full" then Color.DARK_GREEN else Color.DARK_ORANGE
);

Code:
declare lower;

input length = 100;
input showMomentum = yes;
input momentumLength = 10;
input momentumThreshold = 2.0; # % change over N bars to trigger triangle
input channelMode = {default "Full", "Half"}; # Deplex Mode

# Highest high and percent from high
def highestHigh = Highest(high, length);
def percentFromHigh = (close - highestHigh) / highestHigh;

plot Percent = percentFromHigh * 100;
Percent.SetDefaultColor(Color.CYAN);
Percent.SetLineWeight(2);

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);
ZeroLine.SetStyle(Curve.SHORT_DASH);

# Adaptive levels based on channel mode
def cutoffLevel = if channelMode == channelMode."Full" then -10 else -5;
def lightPullbackLevel = -2;

plot MinusLightLine = lightPullbackLevel;
MinusLightLine.SetDefaultColor(Color.YELLOW);
MinusLightLine.SetStyle(Curve.SHORT_DASH);

plot MinusCutoffLine = cutoffLevel;
MinusCutoffLine.SetDefaultColor(Color.LIGHT_RED);
MinusCutoffLine.SetStyle(Curve.SHORT_DASH);

# Clouds based on current mode
AddCloud(
    if Percent > cutoffLevel then ZeroLine else Double.NaN,
    if Percent > cutoffLevel then MinusCutoffLine else Double.NaN,
    Color.DARK_GREEN, Color.DARK_GREEN
);
AddCloud(
    if Percent <= cutoffLevel then MinusCutoffLine else Double.NaN,
    if Percent <= cutoffLevel then Percent else Double.NaN,
    Color.DARK_RED, Color.DARK_RED
);

# Momentum calculation
def priceChangePct = ((close - close[momentumLength]) / close[momentumLength]) * 100;
def momentumCondition = showMomentum and priceChangePct >= momentumThreshold;

# Triangle ON ZeroLine
plot MomentumMarker = if momentumCondition then ZeroLine else Double.NaN;
MomentumMarker.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
MomentumMarker.SetDefaultColor(Color.YELLOW);
MomentumMarker.SetLineWeight(3);

# Labels
AddLabel(yes,
    "Pct from " + length + "-bar High: " + AsPercent(percentFromHigh),
    if percentFromHigh > 0 then Color.GREEN
    else if percentFromHigh > -0.02 then Color.YELLOW
    else Color.RED
);

AddLabel(yes,
    if channelMode == channelMode."Full"
    then "Mode: Full Deplex (-10%)"
    else "Mode: Half Deplex (-5%)",
    if channelMode == channelMode."Full" then Color.DARK_GREEN else Color.DARK_ORANGE
);
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
320 Online
Create Post

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