This Indicator Tracks the L2 and shows its trending directions. In addition a ATR Strength label to track as well.
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.
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
);