I posted an indicator earlier that I was having problems with. I think I have that solved now. I have some notes for this indicator because it covers a lot of territory.
Here are the notes and I will post the code at the end of the notes:
Signal Color Guide
Color Symbol Meaning When to Pay Attention
Cyan (Light Blue) ↑ Up Arrow Basic Confluence - 2+ technical levels aligning (EMAs, pivots, Fibs, etc.) Potential support/resistance zones
Orange △ Triangle Strong Confluence - 3+ levels aligning + High Volume Strong momentum/breakout potential
Magenta (Pink) ↓ Down Arrow Ultimate Confluence - 3+ levels aligning + Pivot Point High-probability reversal/breakout signals
How to Use These Signals
Cyan Up Arrows (↑)
Example: EMA21 + Daily Pivot align at the same price.
Action: Watch for bounces (if near support) or breaks (if near resistance).
Orange Triangles (△)
Example: EMA8 + Weekly Pivot + Fib Level align with 1.5x average volume.
Action: High-volume breakouts often continue trending—consider following the momentum.
Magenta Down Arrows (↓)
Example: EMA50 + Monthly Pivot + Yesterday’s 50% Range align at a local high/low.
Here is the Think or swim Script:
Here are the notes and I will post the code at the end of the notes:
Signal Color Guide
Color Symbol Meaning When to Pay Attention
Cyan (Light Blue) ↑ Up Arrow Basic Confluence - 2+ technical levels aligning (EMAs, pivots, Fibs, etc.) Potential support/resistance zones
Orange △ Triangle Strong Confluence - 3+ levels aligning + High Volume Strong momentum/breakout potential
Magenta (Pink) ↓ Down Arrow Ultimate Confluence - 3+ levels aligning + Pivot Point High-probability reversal/breakout signals
How to Use These Signals
Cyan Up Arrows (↑)
Example: EMA21 + Daily Pivot align at the same price.
Action: Watch for bounces (if near support) or breaks (if near resistance).
Orange Triangles (△)
Example: EMA8 + Weekly Pivot + Fib Level align with 1.5x average volume.
Action: High-volume breakouts often continue trending—consider following the momentum.
Magenta Down Arrows (↓)
Example: EMA50 + Monthly Pivot + Yesterday’s 50% Range align at a local high/low.
Here is the Think or swim Script:
Code:
# Multi-Level Confluence Indicator (Final Working Version)
# All errors fixed - using dots for StrongSignal
declare upper;
# Inputs
input tolerance = 0.005;
input showLabels = yes;
input volumePeriod = 20;
input volumeMultiplier = 1.5;
input lookback = 2;
# EMAs
def EMA8 = ExpAverage(close, 8);
def EMA21 = ExpAverage(close, 21);
def EMA50 = ExpAverage(close, 50);
# Pivots
def dailyPivot = (high(period = "DAY")[1] + low(period = "DAY")[1] + close(period = "DAY")[1]) / 3;
def weeklyPivot = (high(period = "WEEK")[1] + low(period = "WEEK")[1] + close(period = "WEEK")[1]) / 3;
# Yesterday's Range
def yesterdayHigh = high(period = "DAY")[1];
def yesterdayLow = low(period = "DAY")[1];
def rangeLevel50 = yesterdayLow + (yesterdayHigh - yesterdayLow) * 0.5;
# Volume
def avgVolume = Average(volume, volumePeriod);
def highVolume = volume > avgVolume * volumeMultiplier;
# Pivot Detection
def isPivotHigh = high > Highest(high[1], lookback) and high > Highest(high[-lookback], lookback);
def isPivotLow = low < Lowest(low[1], lookback) and low < Lowest(low[-lookback], lookback);
# Level Matching
script isNear {
input level = 0;
input price = 0;
input tol = 0.005;
plot result = AbsValue(level - price) <= (price * tol);
}
# Confluence Check
def confluenceCount =
(if isNear(EMA8, close, tolerance) then 1 else 0) +
(if isNear(EMA21, close, tolerance) then 1 else 0) +
(if isNear(dailyPivot, close, tolerance) then 1 else 0) +
(if isNear(rangeLevel50, close, tolerance) then 1 else 0);
# Signal Conditions
def hasConfluence = confluenceCount >= 2;
def strongConfluence = confluenceCount >= 3 and highVolume;
def ultimateConfluence = confluenceCount >= 3 and (isPivotHigh or isPivotLow);
# Plot Statements (with dots for StrongSignal)
plot ConfluenceSignal = if hasConfluence then low else Double.NaN;
ConfluenceSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP); # Cyan up arrow
ConfluenceSignal.SetDefaultColor(Color.CYAN);
ConfluenceSignal.SetLineWeight(3);
plot StrongSignal = if strongConfluence then low else Double.NaN;
StrongSignal.SetPaintingStrategy(PaintingStrategy.POINTS); # Changed to dots
StrongSignal.SetDefaultColor(Color.ORANGE);
StrongSignal.SetLineWeight(4);
plot UltimateSignal = if ultimateConfluence then low else Double.NaN;
UltimateSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); # Magenta down arrow
UltimateSignal.SetDefaultColor(Color.MAGENTA);
UltimateSignal.SetLineWeight(5);
# Alerts
Alert(hasConfluence, "2+ Level Confluence", Alert.BAR, Sound.DING);
Alert(strongConfluence, "Strong Confluence + High Volume", Alert.BAR, Sound.BELL);
Alert(ultimateConfluence, "Ultimate Confluence + Pivot", Alert.BAR, Sound.CHIMES);
# Labels
AddLabel(showLabels, "Confluences: " + confluenceCount,
if ultimateConfluence then Color.MAGENTA
else if strongConfluence then Color.ORANGE
else if hasConfluence then Color.CYAN
else Color.GRAY);
AddLabel(showLabels, "Volume: " + Round(volume/avgVolume, 1) + "x Avg",
if highVolume then Color.GREEN else Color.GRAY);
Action: High-probability reversal zones—look for candlestick confirmations (e.g., doji, engulfing).
Last edited by a moderator: