AGAIG The Traders Edge Labels For ThinkOrSwim

csricksdds

Trader Educator
VIP
AGAIG THE TRADERS EDGE LABELS
A Professional Trading Dashboard for ThinkorSwim

Developed for scalping, swing trading, and options plays across all timeframes
JHVuiUk.png

NOTE: I use these indicators with my AGAIG Heikin Ashi Chart but will not post it here or they will label this as “repainting” and I don’t want that for the indicators themselves. You may use them on any charting you choose! I have also put toggle off/on for the labels in case you do not want to show them all? I also made the labels sizeable and moveable.


OVERVIEW

The Traders Edge is a two-study ThinkorSwim dashboard combining eight professional-grade indicators into a single unified signal system. Rather than cluttering your chart with multiple separate indicators, The Traders Edge consolidates everything into a clean label bar that tells you exactly what the market is doing, how strong the move is, and when to pull the trigger — all at a glance.

The system works on any timeframe from 1-minute scalping to daily options position trading and automatically adapts its stop distance and signal sensitivity to current market volatility.


SYSTEM ARCHITECTURE

Study 1 — Price Chart (declare upper)
displays chart bubbles with stop distance, and a compact label bar across the top of the price chart.

Study 2 — Lower Subgraph (declare lower) Displays expanded readable labels showing complete status of all indicators.

Both studies share identical inputs and logic — keep all settings matched between them for consistent readings.

THE INDICATORS

Range Filter
The core trend detection engine. Uses a dual smoothed ATR-based filter (fast period 27, slow period 55) to identify sustained directional moves while filtering out noise. The filter line plots green when trending up and red when trending down. Unlike a simple moving average the Range Filter only moves when price moves meaningfully — small wiggles and consolidation periods leave it flat, giving you a clean read on true trend direction.

VWAP — Volume Weighted Average Price The institutional reference level for the session. Price above VWAP indicates institutional buying pressure and a bullish bias. Price below VWAP indicates selling pressure and a bearish bias. The dashboard uses your custom VWAP with four filter modes selectable in study settings — Moving Average, VWAP, MA and VWAP combined, or no filter — allowing you to tune confirmation requirements to your trading style and timeframe.

RSI — Relative Strength Index Set to a fast 5-period for scalping to catch rapid oversold and overbought conditions. Used as the final entry trigger — the system identifies the trend bias first, then waits for RSI to confirm a pullback entry. RSI below 20 with a bull bias is your long trigger. RSI above 80 with a bear bias is your short trigger. For swing trading and options plays adjust to RSI 14 with 70/30 levels in study settings.

ATR — Average True Range Provides dynamic stop loss distances that automatically adjust to current volatility. The stop distance shown in the ATR label is calculated as ATR(14) multiplied by 1.5 and represents the dollar amount you place your stop beyond your entry price. On a long trade subtract the ATR stop from your entry. On a short trade add it above your entry. This ensures your stop is always sized to current market conditions rather than a fixed arbitrary amount.

Volume Compares current bar volume to its 20-bar average. Above average volume confirms that a signal has real participation behind it. Signals occurring on below average volume carry significantly more risk and should be sized down or skipped entirely.

Implied Volatility Monitors the options market for unusual activity. When IV rises above 1.5 times its 20-bar average the label turns magenta and an alert fires — indicating the options market is pricing in a larger move than usual. An IV spike without a corresponding price move often signals smart money positioning ahead of a catalyst. An IV spike after a large price move may indicate the move is exhausted.

Relative Volume (RVOL) Compares current volume to the same period average with greater sensitivity than the simple volume label. Green at 2.0x or above indicates strong institutional participation. Yellow at 1.5x indicates building interest. Gray below 1.5x indicates retail noise only. RVOL 3x or higher combined with an IV spike is the strongest possible activity signal the dashboard can produce.

VWAP Distance Measures how far price has traveled from VWAP in dollar terms and colors the label based on ATR thresholds. Green means price is within half an ATR of VWAP — an ideal entry zone. Yellow means price is between half and one full ATR from VWAP — acceptable but not ideal. Red means price is more than one ATR from VWAP — extended and high risk for new entries. A red VWAP Distance on a new signal means wait for a pullback toward VWAP before entering.

MACD — Moving Average Convergence Divergence Standard 12/26/9 settings provide momentum confirmation. The label shows four states — BULL CROSS (green, momentum just flipped bullish), BEAR CROSS (red, momentum just flipped bearish), MACD BULL (light green, sustained bullish momentum), MACD BEAR (light red, sustained bearish momentum). The four-color histogram in Study 2 shows bright green for growing bullish momentum, dark green for fading bullish momentum, bright red for growing bearish momentum, and dark red for recovering bearish momentum.

THE LABEL BAR

Labels appear left to right in this order on both studies:

== THE TRADERS EDGE == — Confirms the study is active

PRICE ABOVE/BELOW VWAP — Green above, red below. Primary bias filter.

TREND UP/DOWN (n bars) — Green up, red down. Bar count shows trend maturity. Fresh 1-5 bars is highest probability. Extended 15+ bars means wait for pullback.

RSI(5): value — Green oversold, red overbought, gray neutral. Your entry trigger.

ATR STOP: $value — Yellow always. Your stop loss distance from entry in dollars.

VOL HIGH / VOL normal — Yellow high, gray normal. Participation confirmation.

IV % SPIKE / IV % — Magenta spike, gray normal. Unusual options activity proxy.

RVOL: value x — Green 2x+, yellow 1.5x, gray below 1.5x. Institutional participation level.

VWAP DIST: $value — Green close, yellow moderate, red extended. Entry quality filter.

MACD CROSS / BULL / BEAR — Green cross, red cross, light green bull, light red bear. Momentum state.

BULL BIAS / BEAR BIAS / LONG / SHORT — The master signal label. Light green bull bias, light red bear bias, bright green long signal, bright red short signal. Bias shows bar count in parentheses.

SIGNAL STATES

BULL BIAS (n) / BEAR BIAS (n)
The Range Filter and VWAP are aligned in a direction but RSI has not yet confirmed an entry. This is your standby state — the trend is identified, now wait for the pullback. The bar count tells you how long the trend has been running.

LONG SIGNAL All three conditions are met simultaneously — Range Filter trending up, price above VWAP, RSI oversold. This is your entry trigger for long positions.

SHORT SIGNAL All three conditions are met simultaneously — Range Filter trending down, price below VWAP, RSI overbought. This is your entry trigger for short positions.

INIT The system is initializing on the first bars of the chart. This clears automatically once enough bars have loaded for the Range Filter to fully calculate — typically within the first 55 bars.

FILTER SELECT MODES

Selectable in study settings for both studies:

Moving Average — Range Filter compared to 9-period EMA. Good for fast moving stocks on short timeframes.

VWAP — Range Filter compared to VWAP. Best for intraday scalping and day trading. Recommended default.

MA and VWAP — Both conditions must be met simultaneously. Strongest filter, fewest signals, highest quality. Recommended for swing trading and options plays.

Don't use Filter — Raw Range Filter signals only with no secondary confirmation. Most signals, lowest quality. Use for research and backtesting only.

TIMEFRAME GUIDE

1-minute and 5-minute — Scalping
Use VWAP filter mode. RSI 5 with 80/20 levels. Focus on RVOL and VWAP Distance labels. Bias bar count moves quickly. ATR stop will be tight. Best during 8:30-11:00 AM and 2:00-3:30 PM EST sessions only.

15-minute and 30-minute — Intraday Swing Use VWAP filter mode. RSI 5 or 7 with 75/25 levels. IV spike becomes more meaningful at this timeframe. Good for same day options entries.

1-hour and 4-hour — Swing Trading Use MA and VWAP filter mode. Adjust RSI to 14 with 70/30 levels in study settings. VWAP less relevant on 4-hour — consider switching to weekly VWAP. ATR stop will be wider — size positions accordingly. Best for multi-day options plays.

Daily — Options Position Trading Use MA and VWAP filter mode. RSI 14 with 70/30 levels. Every signal carries significant weight. RVOL 2x or above on daily timeframe represents major institutional activity. IV spike on daily often indicates earnings, catalyst, or news-driven positioning. ATR stop defines your options strike selection zone.

IDEAL ENTRY CHECKLIST
For the highest conviction trades all of the following should align:
  • PRICE ABOVE VWAP (long) or PRICE BELOW VWAP (short)
  • TREND UP fresh 1-8 bars (long) or TREND DOWN fresh 1-8 bars (short)
  • RSI OVERSOLD (long) or RSI OVERBOUGHT (short)
  • VOL HIGH or at minimum VOL normal
  • IV normal or IV SPIKE as additional confirmation
  • RVOL 1.5x or above, ideally 2.0x or above
  • VWAP DIST green or yellow — not red
  • MACD BULL or BULL CROSS (long) / MACD BEAR or BEAR CROSS (short)
  • LONG SIGNAL or SHORT SIGNAL active
When all labels align this represents your maximum conviction entry. Partial alignment means reduce size or wait for better confirmation.

ALERTS
The following alerts fire automatically when conditions are met:
  • SCALP LONG — Long signal triggered
  • SCALP SHORT — Short signal triggered
  • IV SPIKE — Unusual implied volatility detected
  • MACD BULL CROSS — Momentum flipping bullish
  • MACD BEAR CROSS — Momentum flipping bearish
Configure alert notifications in ThinkorSwim under the Alerts tab to receive sound, pop-up, or mobile push notifications.

ADJUSTABLE INPUTS
All parameters are adjustable in TOS study settings without touching code:

Input
Default
Description
filterSelectVWAPFilter confirmation mode
vwapTimeFrameDAYVWAP reset period
fastPeriod27Range Filter fast period
slowPeriod55Range Filter slow period
fastMultiplier1.6Range Filter fast sensitivity
slowMultiplier2.0Range Filter slow sensitivity
rsiLength5RSI period
rsiOverbought80RSI overbought level
rsiOversold20RSI oversold level
atrLength14ATR period
atrMult1.5ATR stop multiplier
volAvgLength20Volume average period
ivAvgLength20IV average period
ivMultiplier1.5IV spike threshold
macdFast12MACD fast EMA
macdSlow26MACD slow EMA
macdSignal9MACD signal line
showBubblesyesChart bubble on/off
showTitleyesIndividual label toggles

TIPS FOR BEST RESULTS

Keep filterSelect and vwapTimeFrame identical in both Study 1 and Study 2 at all times to ensure label consistency between the price chart and lower panel.

On choppy or sideways days the Range Filter may alternate between bull and bear frequently — if BULL BIAS and BEAR BIAS are flipping every few bars sit out and wait for directional conviction.

The VWAP Distance red warning on a new signal is one of the most valuable filters in the system — it prevents chasing extended moves and keeps your entries near institutional reference levels.

RVOL and IV working together is the closest proxy available within ThinkorSwim to detecting unusual options activity. When both fire simultaneously on a fresh bias signal treat it as a high priority setup.

For options trading use the ATR stop value to guide strike selection — buy strikes within one ATR of current price for aggressive plays, two ATR for more conservative positioning.



The Traders Edge — Built for ThinkorSwim Studies: declare upper (Study 1) and declare lower (Study 2) Best timeframes: 1m / 5m scalping — 15m / 30m intraday — 1hr / Daily options


I hope you like these labels as they might make your trade entries/exits easier? Feedback is always appreciated.

AGAIG The Traders Edge Labels Upper Indicator Link:
http://tos.mx/!G4B5nG9S
Code:
# ============================================================
# AGAIG THE TRADERS EDGE — STUDY 1 — Price Chart 6/8/26 by C.S.Ricks
# Range Filter + Your VWAP + RSI + ATR + Volume + IV + RVOL + MACD
# declare upper — add to price chart
# ============================================================

declare upper;

# ─── RANGE FILTER INPUTS ─────────────────────────────────
input filterSelect     = {Default "Moving Average", "VWAP", "MA & VWAP", "Don't use Filter"};
input source           = close;
input fastPeriod       = 27;
input slowPeriod       = 55;
input fastMultiplier   = 1.6;
input slowMultiplier   = 2.0;
input LabelSize = FontSize.MEDIUM;
input LabelLocation = Location.TOP_LEFT;


# ─── VWAP INPUTS ─────────────────────────────────────────
input vwapTimeFrame    = {default DAY, WEEK, MONTH};
input showVwapLine     = yes;

# ─── RSI INPUTS ──────────────────────────────────────────
input rsiLength        = 5;
input rsiOverbought    = 80;
input rsiOversold      = 20;

# ─── ATR INPUTS ──────────────────────────────────────────
input atrLength        = 14;
input atrMult          = 1.5;

# ─── VOLUME INPUTS ───────────────────────────────────────
input volAvgLength     = 20;

# ─── IV INPUTS ───────────────────────────────────────────
input ivAvgLength      = 20;
input ivMultiplier     = 1.5;

# ─── MACD INPUTS ─────────────────────────────────────────
input macdFast         = 12;
input macdSlow         = 26;
input macdSignal       = 9;

# ─── DISPLAY INPUTS ──────────────────────────────────────
input showBubbles      = yes;

# ─── LABEL TOGGLES ───────────────────────────────────────
input showTitle        = yes;
input showVWAP         = yes;
input showTrend        = yes;
input showRSI          = yes;
input showATR          = yes;
input showVOL          = yes;
input showIV           = yes;
input showRVOL         = yes;
input showVWAPDist     = yes;
input showMACD         = yes;
input showBias         = yes;

# ─── VWAP ────────────────────────────────────────────────
def na       = Double.NaN;
def quickEMA = ExpAverage(source, 9);
def wap      = Reference vwap(timeFrame = vwapTimeFrame).price;

# ─── RANGE FILTER SCRIPTS ────────────────────────────────
script smoothrng {
    input src  = close;
    input per  = 100;
    input mult = 3;
    def wper      = per * 2 - 1;
    def srcDif    = AbsValue(src - src[1]);
    def avrng     = ExpAverage(srcDif, per);
    def smoothrng = ExpAverage(avrng, wper) * mult;
    plot result   = smoothrng;
}

script rngfilt {
    input src = close;
    input r   = 0;
    def rngfilt = CompoundValue(1,
        if !rngfilt[1] then src
        else if src > rngfilt[1] then
            if (src - r) < rngfilt[1] then rngfilt[1] else (src - r)
        else
            if (src + r) > rngfilt[1] then rngfilt[1] else (src + r),
        src);
    plot result = rngfilt;
}

# ─── RANGE FILTER CALCULATIONS ───────────────────────────
def smrng1 = smoothrng(source, fastPeriod, fastMultiplier);
def smrng2 = smoothrng(source, slowPeriod, slowMultiplier);
def smrng  = (smrng1 + smrng2) / 2;
def filt   = rngfilt(source, smrng);

def upward   = if filt > filt[1] then upward[1] + 1
               else if filt < filt[1] then 0
               else upward[1];
def downward = if filt < filt[1] then downward[1] + 1
               else if filt > filt[1] then 0
               else downward[1];

# ─── FILTER SELECT SWITCH ────────────────────────────────
def filterUp;
def filterDn;
Switch (filterSelect) {
Case "VWAP":
    filterUp = filt > wap;
    filterDn = filt < wap;
Case "MA & VWAP":
    filterUp = filt > quickEMA and filt > wap;
    filterDn = filt < quickEMA and filt < wap;
Case "Don't use Filter":
    filterUp = yes;
    filterDn = yes;
Default:
    filterUp = filt > quickEMA;
    filterDn = filt < quickEMA;
}

# ─── SIGNAL CONDITIONS ───────────────────────────────────
def longCond  = source > filt and source > source[1] and upward   > 0 and filterUp;
def shortCond = source < filt and source < source[1] and downward > 0 and filterDn;

# ─── CONDINI — seeded to avoid init bars ─────────────────
def CondIni = CompoundValue(1,
    if longCond       then  1
    else if shortCond then -1
    else CondIni[1],
    0);

# ─── RSI ─────────────────────────────────────────────────
def rsiVal = RSI(Length = rsiLength);

# ─── ATR ─────────────────────────────────────────────────
def atrVal   = ATR(Length = atrLength);
def stopDist = Round(atrVal * atrMult, 2);

# ─── VOLUME ──────────────────────────────────────────────
def volAvg  = Average(volume, volAvgLength);
def highVol = volume > volAvg;

# ─── IMPLIED VOLATILITY ──────────────────────────────────
def iv        = imp_volatility();
def ivAvg     = Average(iv, ivAvgLength);
def ivSpike   = iv > ivAvg * ivMultiplier;
def ivPercent = Round(iv * 100, 1);

# ─── RELATIVE VOLUME ─────────────────────────────────────
def rvol     = Round(volume / Average(volume, 20), 1);
def rvolHigh = rvol >= 2.0;
def rvolMod  = rvol >= 1.5 and rvol < 2.0;

# ─── VWAP DISTANCE ───────────────────────────────────────
def vwapDist = Round(AbsValue(close - wap), 2);

# ─── MACD ────────────────────────────────────────────────
def macdLine  = ExpAverage(close, macdFast) - ExpAverage(close, macdSlow);
def sigLine   = ExpAverage(macdLine, macdSignal);
def macdHist  = macdLine - sigLine;
def macdBull  = macdLine > sigLine;
def macdCross = macdLine crosses above sigLine;
def macdXdown = macdLine crosses below sigLine;

# ─── SIGNALS ─────────────────────────────────────────────
def longSignal  = CondIni ==  1 and rsiVal < rsiOversold;
def shortSignal = CondIni == -1 and rsiVal > rsiOverbought;
def bullBias    = CondIni ==  1;
def bearBias    = CondIni == -1;

# ─── LABELS ──────────────────────────────────────────────
AddLabel(showTitle, "== THE TRADERS EDGE ==", Color.WHITE, LabelLocation, LabelSize);

AddLabel(showTrend,
    if upward > 0 then "TREND UP" else "TREND DOWN",
    if upward > 0 then Color.GREEN else Color.RED, LabelLocation, LabelSize);

AddLabel(showBias,
    if longSignal       then "LONG"
    else if shortSignal then " SHORT"
    else if bullBias    then "BULL BIAS (" + upward   + ")"
    else if bearBias    then "BEAR BIAS (" + downward + ")"
    else "INIT",
    if longSignal       then Color.GREEN
    else if shortSignal then Color.RED
    else if bullBias    then Color.LIGHT_GREEN
    else if bearBias    then Color.LIGHT_RED
    else Color.GRAY, LabelLocation, LabelSize);

AddLabel(showMACD,
    if macdCross  then "MACD CROSS"
    else if macdXdown then "MACD CROSS"
    else if macdBull  then "MACD BULL"
    else "MACD BEAR",
    if macdCross  then Color.GREEN
    else if macdXdown then Color.RED
    else if macdBull  then Color.LIGHT_GREEN
    else Color.LIGHT_RED, LabelLocation, LabelSize);



AddLabel(showVWAP,
    if filterUp then "PRICE ABOVE VWAP" else "PRICE BELOW VWAP",
    if filterUp then Color.GREEN else Color.RED, LabelLocation, LabelSize);

AddLabel(showVWAPDist,
    "VWAP DIST: " + (if close > wap then "$" else "$") + vwapDist,
    if vwapDist < atrVal * 0.5 then Color.GREEN
    else if vwapDist < atrVal   then Color.YELLOW
    else Color.RED, LabelLocation, LabelSize);


AddLabel(showVOL,
    if highVol then "VOL ▲ HIGH" else "VOL normal",
    if highVol then Color.YELLOW else Color.GRAY, LabelLocation, LabelSize);

AddLabel(showIV,
    if ivSpike
    then "IV ▲ " + ivPercent + "% SPIKE"
    else "IV " + ivPercent + "%",
    if ivSpike then Color.MAGENTA else Color.GRAY, LabelLocation, LabelSize);

AddLabel(showRVOL,
    "RVOL: " + rvol + "x",
    if rvolHigh then Color.GREEN
    else if rvolMod then Color.YELLOW
    else Color.GRAY, LabelLocation, LabelSize);



AddLabel(showRSI,
    "R:" + Round(rsiVal, 0),
    if rsiVal > rsiOverbought then Color.RED
    else if rsiVal < rsiOversold then Color.GREEN
    else Color.GRAY, LabelLocation, LabelSize);

AddLabel(showATR,
    "ATR: $" + stopDist,
    Color.YELLOW, LabelLocation, LabelSize);




# ─── ALERTS ──────────────────────────────────────────────
Alert(longSignal,  "SCALP LONG  — RF bull + VWAP above + RSI OS", Alert.BAR, Sound.Ding);
Alert(shortSignal, "SCALP SHORT — RF bear + VWAP below + RSI OB", Alert.BAR, Sound.Bell);
Alert(ivSpike,     "IV SPIKE — unusual implied volatility detected", Alert.BAR, Sound.Ring);
Alert(macdCross,   "MACD BULL CROSS — momentum flipping bullish",   Alert.BAR, Sound.Ding);
Alert(macdXdown,   "MACD BEAR CROSS — momentum flipping bearish",   Alert.BAR, Sound.Bell);


AGAIG The Traders Edge Labels Lower Indicator Link: http://tos.mx/!UT0yulpM
Code:
# ============================================================
# AGAIG THE TRADERS EDGE — STUDY 2 — Lower Status Panel 6/8/26 by C.S.Ricks
# Range Filter + Your VWAP + RSI + ATR + Volume + IV + RVOL + MACD
# declare lower — add as separate study
# ============================================================

declare lower;

# ─── RANGE FILTER INPUTS ─────────────────────────────────
input filterSelect     = {Default "Moving Average", "VWAP", "MA & VWAP", "Don't use Filter"};
input source           = close;
input fastPeriod       = 27;
input slowPeriod       = 55;
input fastMultiplier   = 1.6;
input slowMultiplier   = 2.0;

# ─── VWAP INPUTS ─────────────────────────────────────────
input vwapTimeFrame    = {default DAY, WEEK, MONTH};

# ─── RSI INPUTS ──────────────────────────────────────────
input rsiLength        = 5;
input rsiOverbought    = 80;
input rsiOversold      = 20;

# ─── ATR INPUTS ──────────────────────────────────────────
input atrLength        = 14;
input atrMult          = 1.5;

# ─── VOLUME INPUTS ───────────────────────────────────────
input volAvgLength     = 20;

# ─── IV INPUTS ───────────────────────────────────────────
input ivAvgLength      = 20;
input ivMultiplier     = 1.5;

# ─── MACD INPUTS ─────────────────────────────────────────
input macdFast         = 12;
input macdSlow         = 26;
input macdSignal       = 9;

# ─── LABEL TOGGLES ───────────────────────────────────────
input showTitle        = yes;
input showVWAP         = yes;
input showTrend        = yes;
input showRSI          = yes;
input showATR          = yes;
input showVOL          = yes;
input showIV           = yes;
input showRVOL         = yes;
input showVWAPDist     = yes;
input showMACD         = yes;
input showBias         = yes;

# ─── VWAP ────────────────────────────────────────────────
def na       = Double.NaN;
def quickEMA = ExpAverage(source, 9);
def wap      = Reference vwap(timeFrame = vwapTimeFrame).price;

# ─── RANGE FILTER SCRIPTS ────────────────────────────────
script smoothrng {
    input src  = close;
    input per  = 100;
    input mult = 3;
    def wper      = per * 2 - 1;
    def srcDif    = AbsValue(src - src[1]);
    def avrng     = ExpAverage(srcDif, per);
    def smoothrng = ExpAverage(avrng, wper) * mult;
    plot result   = smoothrng;
}

script rngfilt {
    input src = close;
    input r   = 0;
    def rngfilt = CompoundValue(1,
        if !rngfilt[1] then src
        else if src > rngfilt[1] then
            if (src - r) < rngfilt[1] then rngfilt[1] else (src - r)
        else
            if (src + r) > rngfilt[1] then rngfilt[1] else (src + r),
        src);
    plot result = rngfilt;
}

# ─── RANGE FILTER CALCULATIONS ───────────────────────────
def smrng1 = smoothrng(source, fastPeriod, fastMultiplier);
def smrng2 = smoothrng(source, slowPeriod, slowMultiplier);
def smrng  = (smrng1 + smrng2) / 2;
def filt   = rngfilt(source, smrng);

def upward   = if filt > filt[1] then upward[1] + 1
               else if filt < filt[1] then 0
               else upward[1];
def downward = if filt < filt[1] then downward[1] + 1
               else if filt > filt[1] then 0
               else downward[1];

# ─── FILTER SELECT SWITCH ────────────────────────────────
def filterUp;
def filterDn;
Switch (filterSelect) {
Case "VWAP":
    filterUp = filt > wap;
    filterDn = filt < wap;
Case "MA & VWAP":
    filterUp = filt > quickEMA and filt > wap;
    filterDn = filt < quickEMA and filt < wap;
Case "Don't use Filter":
    filterUp = yes;
    filterDn = yes;
Default:
    filterUp = filt > quickEMA;
    filterDn = filt < quickEMA;
}

# ─── SIGNAL CONDITIONS ───────────────────────────────────
def longCond  = source > filt and source > source[1] and upward   > 0 and filterUp;
def shortCond = source < filt and source < source[1] and downward > 0 and filterDn;

# ─── CONDINI — seeded to avoid init bars ─────────────────
def CondIni = CompoundValue(1,
    if longCond       then  1
    else if shortCond then -1
    else CondIni[1],
    0);

# ─── RSI ─────────────────────────────────────────────────
def rsiVal = RSI(Length = rsiLength);

# ─── ATR ─────────────────────────────────────────────────
def atrVal   = ATR(Length = atrLength);
def stopDist = Round(atrVal * atrMult, 2);

# ─── VOLUME ──────────────────────────────────────────────
def volAvg  = Average(volume, volAvgLength);
def highVol = volume > volAvg;

# ─── IMPLIED VOLATILITY ──────────────────────────────────
def iv        = imp_volatility();
def ivAvg     = Average(iv, ivAvgLength);
def ivSpike   = iv > ivAvg * ivMultiplier;
def ivPercent = Round(iv * 100, 1);

# ─── RELATIVE VOLUME ─────────────────────────────────────
def rvol     = Round(volume / Average(volume, 20), 1);
def rvolHigh = rvol >= 2.0;
def rvolMod  = rvol >= 1.5 and rvol < 2.0;

# ─── VWAP DISTANCE ───────────────────────────────────────
def vwapDist = Round(AbsValue(close - wap), 2);

# ─── MACD ────────────────────────────────────────────────
def macdLine  = ExpAverage(close, macdFast) - ExpAverage(close, macdSlow);
def sigLine   = ExpAverage(macdLine, macdSignal);
def macdHist  = macdLine - sigLine;
def macdBull  = macdLine > sigLine;
def macdCross = macdLine crosses above sigLine;
def macdXdown = macdLine crosses below sigLine;

# ─── SIGNALS ─────────────────────────────────────────────
def longSignal  = CondIni ==  1 and rsiVal < rsiOversold;
def shortSignal = CondIni == -1 and rsiVal > rsiOverbought;
def bullBias    = CondIni ==  1;
def bearBias    = CondIni == -1;

# ─── LOWER PANEL LABELS ──────────────────────────────────
AddLabel(showTitle, "== THE TRADERS EDGE ==", Color.WHITE);

AddLabel(showTrend,
    if upward > 0
    then "TREND UP ("   + upward   + " bars)"
    else "TREND DOWN (" + downward + " bars)",
    if upward > 0 then Color.GREEN else Color.RED);

AddLabel(showBias,
    if longSignal       then "LONG SIGNAL"
    else if shortSignal then "SHORT SIGNAL"
    else if bullBias    then "BULL BIAS (" + upward   + ")"
    else if bearBias    then "BEAR BIAS (" + downward + ")"
    else "INIT",
    if longSignal       then Color.GREEN
    else if shortSignal then Color.RED
    else if bullBias    then Color.LIGHT_GREEN
    else if bearBias    then Color.LIGHT_RED
    else Color.GRAY);

AddLabel(showMACD,
    if macdCross  then "MACD CROSS"
    else if macdXdown then "MACD CROSS"
    else if macdBull  then "MACD BULL"
    else "MACD BEAR",
    if macdCross  then Color.GREEN
    else if macdXdown then Color.RED
    else if macdBull  then Color.LIGHT_GREEN
    else Color.LIGHT_RED);


AddLabel(showVWAP,
    if filterUp then "PRICE ABOVE VWAP" else "PRICE BELOW VWAP",
    if filterUp then Color.GREEN else Color.RED);

AddLabel(showVWAPDist,
    "VWAP DIST: " + (if close > wap then "$" else "$") + vwapDist,
    if vwapDist < atrVal * 0.5 then Color.GREEN
    else if vwapDist < atrVal   then Color.YELLOW
    else Color.RED);

AddLabel(showVOL,
    if highVol then "VOL HIGH" else "VOL NORMAL",
    if highVol then Color.YELLOW else Color.GRAY);

AddLabel(showIV,
    if ivSpike
    then "IV ▲ " + ivPercent + "% SPIKE"
    else "IV " + ivPercent + "%",
    if ivSpike then Color.MAGENTA else Color.GRAY);

AddLabel(showRVOL,
    "RVOL: " + rvol + "x",
    if rvolHigh then Color.GREEN
    else if rvolMod then Color.YELLOW
    else Color.GRAY);




AddLabel(showRSI,
    "RSI(" + rsiLength + "): " + Round(rsiVal, 1) +
    (if rsiVal > rsiOverbought then "OVERBOUGHT"
     else if rsiVal < rsiOversold then "OVERSOLD"
     else "neutral"),
    if rsiVal > rsiOverbought then Color.RED
    else if rsiVal < rsiOversold then Color.GREEN
    else Color.GRAY);

AddLabel(showATR,
    "ATR STOP: $" + stopDist,
    Color.YELLOW);
 
Last edited by a moderator:

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