L2 Trend Upper Chart Label For ThinkOrSwim

Aktion

Member
Plus
This Indicator Tracks the L2 and shows its trending directions. In addition a ATR Strength label to track as well.
1779576483742.png

Scalping / very fast
input sampleSeconds = 3;
input fastLength = 2;
input slowLength = 6;
input atrLength = 10;
input atrMultiplier = 0.03;

Balanced day trading
input sampleSeconds = 5;
input fastLength = 3;
input slowLength = 9;
input atrLength = 14;
input atrMultiplier = 0.05;

Cleaner signals / less noise
input sampleSeconds = 10;
input fastLength = 5;
input slowLength = 13;
input atrLength = 21;
input atrMultiplier = 0.07;

For SPY / QQQ options intraday
Use this as your starting point:
input sampleSeconds = 5;
input fastLength = 3;
input slowLength = 8;
input atrLength = 14;
input atrMultiplier = 0.04;

For 1–2 minute charts, use atrMultiplier 0.03–0.05.
For 5 minute charts, use 0.05–0.08.
For choppy markets, raise the multiplier.
For early morning momentum, lower it slightly.


Code:
# Smart Reversal Trend Label
# Dynamic ATR-Based Strength
# No BID/ASK dependency

input sampleSeconds = 3;
input fastLength = 3;
input slowLength = 8;

# ATR settings
input atrLength = 14;
input atrMultiplier = 0.05;

def price = close;

# Simulated 3-second sampling
def bucket = Floor(GetTime() / (sampleSeconds * 1000));
def newSample = bucket != bucket[1];

# Fast EMA
rec fastEMA =
    if IsNaN(fastEMA[1]) then price
    else if newSample then
        ExpAverage(price, fastLength)
    else fastEMA[1];

# Slow EMA
rec slowEMA =
    if IsNaN(slowEMA[1]) then price
    else if newSample then
        ExpAverage(price, slowLength)
    else slowEMA[1];

# Trend score
def trend = fastEMA - slowEMA;

# Momentum acceleration
def momentum = trend - trend[1];

# ATR-based adaptive threshold
def atr = Average(TrueRange(high, close, low), atrLength);
def dynamicStrength = atr * atrMultiplier;

# Trend conditions
def trendUp = trend > dynamicStrength;
def trendDown = trend < -dynamicStrength;

# Reversal conditions
def reversingUp =
    trendDown[1] and momentum > 0;

def reversingDown =
    trendUp[1] and momentum < 0;

# Labels
# Optional debug label
AddLabel(
    yes,
    "ATR Strength: " + Round(dynamicStrength, 3),
    Color.LIGHT_GRAY
);

AddLabel(
    yes,

    if reversingUp then
        "REV UP ▲ " + Round(price, 2)

    else if reversingDown then
        "REV DN ▼ " + Round(price, 2)

    else if trendUp then
        "TREND UP ▲ " + Round(price, 2)

    else if trendDown then
        "TREND DN ▼ " + Round(price, 2)

    else
        "FLAT → " + Round(price, 2),

    if reversingUp then Color.CYAN
    else if reversingDown then Color.MAGENTA
    else if trendUp then Color.GREEN
    else if trendDown then Color.RED
    else Color.YELLOW
);
 

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