Advanced HUD Indicator For Thinkorswim
Comprehensive ThinkOrSwim HUD displaying price, volume, trend, RSI, MACD, Bollinger Bands, ATR, VWAP, support/resistance & market conditions in real-time.
Indicator Code
thinkscript# Advanced HUD Indicator for ThinkOrSwim
# Comprehensive market information display
declare upper;
# Input parameters for customization
input showPriceInfo = yes;
input showVolumeInfo = yes;
input showVolatilityInfo = yes;
input showTrendInfo = yes;
input showSupportResistance = yes;
input showRSI = yes;
input showMACD = yes;
input showBollingerBands = yes;
input showATR = yes;
input showVWAP = yes;
# Current price data
def currentPrice = close;
def previousClose = close[1];
def dailyChange = currentPrice - open;
def dailyChangePercent = (dailyChange / open) * 100;
def dayHigh = high;
def dayLow = low;
def dayRange = dayHigh - dayLow;
# Volume calculations
def currentVolume = volume;
def avgVolume = Average(volume, 20);
def volumeRatio = currentVolume / avgVolume;
def relativeVolume = volumeRatio;
# Volatility measures
def atr14 = ATR(14);
def atrPercent = (atr14 / currentPrice) * 100;
# Trend indicators
def sma20 = SimpleMovingAvg(close, 20);
def sma50 = SimpleMovingAvg(close, 50);
def sma200 = SimpleMovingAvg(close, 200);
def ema12 = ExpAverage(close, 12);
def ema26 = ExpAverage(close, 26);
# RSI
def rsi14 = RSI(14);
def rsiOverbought = rsi14 > 70;
def rsiOversold = rsi14 < 30;
# MACD
def macdLine = ema12 - ema26;
def signalLine = ExpAverage(macdLine, 9);
def macdHistogram = macdLine - signalLine;
def macdBullish = macdLine > signalLine;
# Bollinger Bands
def bbLength = 20;
def bbNumDevDn = -2.0;
def bbNumDevUp = 2.0;
def bbPrice = close;
def bbSMA = SimpleMovingAvg(bbPrice, bbLength);
def bbUpper = bbSMA + bbNumDevUp * StDev(bbPrice, bbLength);
def bbLower = bbSMA + bbNumDevDn * StDev(bbPrice, bbLength);
def bbPosition = (currentPrice - bbLower) / (bbUpper - bbLower) * 100;
# VWAP
def vwapValue = VWAP();
def vwapDeviation = ((currentPrice - vwapValue) / vwapValue) * 100;
# Support and Resistance levels
def pivot = (high[1] + low[1] + close[1]) / 3;
def r1 = 2 * pivot - low[1];
def s1 = 2 * pivot - high[1];
def r2 = pivot + (high[1] - low[1]);
def s2 = pivot - (high[1] - low[1]);
# Trend determination
def trendUp = sma20 > sma50 and sma50 > sma200;
def trendDown = sma20 < sma50 and sma50 < sma200;
def trendSideways = !trendUp and !trendDown;
# Market condition assessment
def bullishCondition = currentPrice > sma20 and rsi14 > 50 and macdBullish;
def bearishCondition = currentPrice < sma20 and rsi14 < 50 and !macdBullish;
# Volatility condition
def highVolatility = atrPercent > 3;
def lowVolatility = atrPercent < 1;
# Gap information
def gapUp = open > close[1] * 1.005;
def gapDown = open < close[1] * 0.995;
def gapPercent = ((open / close[1]) - 1) * 100;
# Intraday high/low alerts
def nearHigh = currentPrice > dayHigh * 0.995;
def nearLow = currentPrice < dayLow * 1.005;
# Volume-weighted moving average
def vwma = Sum(volume * close, 20) / Sum(volume, 20);
# Stochastic
def stochK = StochasticFull().FullK;
def stochD = StochasticFull().FullD;
# Momentum indicator
def momentum = currentPrice / close[10] - 1;
# Additional technical levels
def resistance = Highest(high, 20);
def support = Lowest(low, 20);
# Session check
def marketOpen = SecondsFromTime(0930) >= 0 and SecondsTillTime(1600) > 0;
# Create HUD Display using AddLabel
AddLabel(showPriceInfo, "PRICE: " + Round(currentPrice, 2) + " (" +
(if dailyChange >= 0 then "+" else "") + Round(dailyChange, 2) +
" / " + (if dailyChangePercent >= 0 then "+" else "") + Round(dailyChangePercent, 2) + "%)",
if dailyChange >= 0 then Color.GREEN else Color.RED);
AddLabel(showPriceInfo, "H: " + Round(dayHigh, 2) + " L: " + Round(dayLow, 2) + " R: " + Round(dayRange, 2), Color.CYAN);
AddLabel(showVolumeInfo, "VOL: " + Round(currentVolume / 1000, 0) + "K " +
"AVG: " + Round(avgVolume / 1000, 0) + "K " +
"REL: " + Round(relativeVolume, 2) + "x",
if relativeVolume > 1.5 then Color.GREEN else if relativeVolume < 0.5 then Color.RED else Color.YELLOW);
AddLabel(showATR, "ATR: " + Round(atr14, 2) +
" (" + Round(atrPercent, 2) + "%)",
if highVolatility then Color.RED else if lowVolatility then Color.YELLOW else Color.WHITE);
AddLabel(showTrendInfo, "TREND: " +
(if trendUp then "UP" else if trendDown then "DOWN" else "SIDEWAYS"),
if trendUp then Color.GREEN else if trendDown then Color.RED else Color.YELLOW);
AddLabel(showTrendInfo, "SMA20: " + Round(sma20, 2) + " SMA50: " + Round(sma50, 2),
if currentPrice > sma20 then Color.GREEN else Color.RED);
AddLabel(showRSI, "RSI: " + Round(rsi14, 1),
if rsiOverbought then Color.RED else if rsiOversold then Color.GREEN else Color.YELLOW);
AddLabel(showMACD, "MACD: " + Round(macdLine, 3) +
" SIG: " + Round(signalLine, 3) +
" HIST: " + Round(macdHistogram, 3),
if macdBullish then Color.GREEN else Color.RED);
AddLabel(showBollingerBands, "BB: " + Round(bbPosition, 0) + "% " +
"U: " + Round(bbUpper, 2) + " L: " + Round(bbLower, 2),
if bbPosition > 80 then Color.RED else if bbPosition < 20 then Color.GREEN else Color.YELLOW);
AddLabel(showVWAP, "VWAP: " + Round(vwapValue, 2) +
" DEV: " + (if vwapDeviation >= 0 then "+" else "") + Round(vwapDeviation, 2) + "%",
if vwapDeviation > 0 then Color.GREEN else Color.RED);
AddLabel(showSupportResistance, "S2: " + Round(s2, 2) + " S1: " + Round(s1, 2) +
" P: " + Round(pivot, 2) + " R1: " + Round(r1, 2) + " R2: " + Round(r2, 2), Color.CYAN);
# Overall market condition
AddLabel(yes, "CONDITION: " +
(if bullishCondition then "BULLISH" else if bearishCondition then "BEARISH" else "NEUTRAL"),
if bullishCondition then Color.GREEN else if bearishCondition then Color.RED else Color.YELLOW);
# Additional technical levels
AddLabel(showSupportResistance, "20D H: " + Round(resistance, 2) + " L: " + Round(support, 2), Color.CYAN);
# Momentum indicator
AddLabel(yes, "10D MOM: " + (if momentum >= 0 then "+" else "") + Round(momentum * 100, 2) + "%",
if momentum > 0 then Color.GREEN else Color.RED);
# Gap information display
AddLabel(gapUp or gapDown, "GAP: " + (if gapUp then "UP" else "DOWN") + " " +
Round(gapPercent, 2) + "%",
if gapUp then Color.GREEN else Color.RED);
# Near high/low alerts
AddLabel(nearHigh, "NEAR HIGH", Color.GREEN);
AddLabel(nearLow, "NEAR LOW", Color.RED);
# Volume-weighted moving average
AddLabel(showVolumeInfo, "VWMA: " + Round(vwma, 2),
if currentPrice > vwma then Color.GREEN else Color.RED);
# Stochastic display
AddLabel(yes, "STOCH: " + Round(stochK, 1) + "/" + Round(stochD, 1),
if stochK > 80 then Color.RED else if stochK < 20 then Color.GREEN else Color.YELLOW);
# Required plot for thinkScript (hidden)
plot Data = Double.NaN;
Data.SetDefaultColor(Color.CURRENT);Original Author Credit
Created by: NiceBreakout
Website: https://www.Nicebreakout.com
Open ThinkorSwim and go to Charts > Studies (fx).
Click Edit Studies > then Create New Study.
Name your indicator (e.g., "My Custom Indicator").
Paste the ThinkScript code into the editor.
Click OK, then Apply to add it to your chart.
Overview
A comprehensive Heads-Up Display (HUD) for ThinkOrSwim that shows key market metrics, technical indicators, and trading signals in an easy-to-read label format at the top of your chart.
What It Displays
Price Information:
- Current price with daily change ($ and %)
- Day's high, low, and range
Volume Analysis:
- Current volume vs 20-day average
- Relative volume ratio
- Volume-weighted moving average (VWMA)
Trend Indicators:
- Overall trend direction (UP/DOWN/SIDEWAYS)
- SMA 20 and 50 day values
- 10-day momentum percentage
Technical Indicators:
- RSI (14) with overbought/oversold alerts
- MACD line, signal, and histogram
- Bollinger Bands position percentage
- ATR with volatility assessment
- Stochastic oscillator
- VWAP with deviation
Support/Resistance:
- Pivot points (S2, S1, Pivot, R1, R2)
- 20-day high/low levels
Market Signals:
- Overall condition (BULLISH/BEARISH/NEUTRAL)
- Gap detection (up/down with %)
- Near high/low alerts
Color Coding
- Green: Bullish signals, positive values
- Red: Bearish signals, negative values
- Yellow: Neutral or warning conditions
- Cyan: Reference levels and support/resistance
Customization
Toggle any section on/off using the input parameters at the top of the script.
Best Used For
Day trading, swing trading, and quick market assessment without cluttering your chart with multiple indicators.
Note: This indicator code is provided free for educational purposes. Test thoroughly before using in live trading.
Legal Disclaimer & Risk Warning
Educational Purpose: This code is provided for educational and informational purposes only. It does not constitute financial, investment, or trading advice.
No Performance Guarantee: Past performance is not indicative of future results. Trading involves substantial risk, including potential loss of capital.
Test Thoroughly: Always test indicators in a paper trading environment before using real money. Verify compatibility with your platform version.
Use at Your Own Risk: You are solely responsible for your trading decisions. We are not liable for any losses resulting from use of this code.
Attribution: If you share or modify this code, please maintain proper attribution to the original author.
By using this code, you acknowledge understanding and acceptance of these terms.
