Sponsored

Magnetic Levels Thinkorswim Indicator

This indicator shows you the key levels where stocks price "magnetizes" or gravitates toward throughout the trading day. Think of these as gravity points that pull price back repeatedly.

Platform:ThinkOrSwim
Language:thinkscript
FREE CODE
Magnetic Levels Thinkorswim Indicator screenshot

Sponsored Insight

Indicator Code

thinkscript
#
# ============================================
# MAGNET LEVELS - Price Attraction Zones
# ============================================
# 
# Shows key levels where tends to gravitate toward:
# 
# - VWAP (Cyan): Strongest intraday magnet - price returns here repeatedly
# - Previous Close (Yellow): Yesterday's close - major retest level
# - Pivot Points (Magenta/Green/Red): Daily support/resistance magnets
# - Opening Range (Light Green/Red): First 30min high/low
# - Round Numbers (Gray dots): Psychological $5 levels
# 
# Orange alerts appear when price nears VWAP or Previous Close
# These levels act like gravity points - watch for retests!
#Created by NiceBreakout.com

# Input parameters
input showVWAP = yes;
input showPreviousClose = yes;
input showOpeningRange = yes;
input showPsychologicalLevels = yes;
input showPivotPoints = yes;
input roundNumberInterval = 5.0;

# ========== VWAP - Intraday Magnet ==========
def vwapValue = reference VWAP();
plot VWAPLine = if showVWAP then vwapValue else Double.NaN;
VWAPLine.SetDefaultColor(Color.CYAN);
VWAPLine.SetLineWeight(2);
VWAPLine.SetStyle(Curve.FIRM);

# ========== Previous Day Close - Strong Magnet ==========
def prevCloseValue = close(period = AggregationPeriod.DAY)[1];
plot PreviousDayClose = if showPreviousClose then prevCloseValue else Double.NaN;
PreviousDayClose.SetDefaultColor(Color.YELLOW);
PreviousDayClose.SetLineWeight(2);
PreviousDayClose.SetStyle(Curve.SHORT_DASH);

# ========== Opening Range High/Low ==========
def isFirstBar = GetTime() crosses above GetLastDay();
def openingHigh = if isFirstBar then high else if high > openingHigh[1] and SecondsFromTime(0930) <= 1800 then high else openingHigh[1];
def openingLow = if isFirstBar then low else if low < openingLow[1] and SecondsFromTime(0930) <= 1800 then low else openingLow[1];

plot ORHigh = if showOpeningRange and SecondsFromTime(0930) > 1800 then openingHigh else Double.NaN;
plot ORLow = if showOpeningRange and SecondsFromTime(0930) > 1800 then openingLow else Double.NaN;
ORHigh.SetDefaultColor(Color.LIGHT_GREEN);
ORLow.SetDefaultColor(Color.LIGHT_RED);
ORHigh.SetLineWeight(1);
ORLow.SetLineWeight(1);

# ========== Pivot Points - Classic Magnets ==========
def dayHigh = high(period = AggregationPeriod.DAY)[1];
def dayLow = low(period = AggregationPeriod.DAY)[1];
def dayClose = close(period = AggregationPeriod.DAY)[1];

def pivotPoint = (dayHigh + dayLow + dayClose) / 3;
def r1Level = 2 * pivotPoint - dayLow;
def s1Level = 2 * pivotPoint - dayHigh;
def r2Level = pivotPoint + (dayHigh - dayLow);
def s2Level = pivotPoint - (dayHigh - dayLow);

plot PivotLine = if showPivotPoints then pivotPoint else Double.NaN;
plot R1Line = if showPivotPoints then r1Level else Double.NaN;
plot S1Line = if showPivotPoints then s1Level else Double.NaN;
plot R2Line = if showPivotPoints then r2Level else Double.NaN;
plot S2Line = if showPivotPoints then s2Level else Double.NaN;

PivotLine.SetDefaultColor(Color.MAGENTA);
R1Line.SetDefaultColor(Color.GREEN);
S1Line.SetDefaultColor(Color.RED);
R2Line.SetDefaultColor(Color.DARK_GREEN);
S2Line.SetDefaultColor(Color.DARK_RED);

PivotLine.SetLineWeight(2);
R1Line.SetLineWeight(1);
S1Line.SetLineWeight(1);
R2Line.SetLineWeight(1);
S2Line.SetLineWeight(1);

R1Line.SetStyle(Curve.SHORT_DASH);
S1Line.SetStyle(Curve.SHORT_DASH);
R2Line.SetStyle(Curve.SHORT_DASH);
S2Line.SetStyle(Curve.SHORT_DASH);

# ========== Psychological Round Numbers ==========
def currentPrice = close;
def nearestRound = Round(currentPrice / roundNumberInterval, 0) * roundNumberInterval;

plot RoundAbove = if showPsychologicalLevels then nearestRound + roundNumberInterval else Double.NaN;
plot RoundBelow = if showPsychologicalLevels then nearestRound - roundNumberInterval else Double.NaN;

RoundAbove.SetDefaultColor(Color.DARK_GRAY);
RoundBelow.SetDefaultColor(Color.DARK_GRAY);
RoundAbove.SetStyle(Curve.POINTS);
RoundBelow.SetStyle(Curve.POINTS);

# ========== Labels ==========
AddLabel(showVWAP, "VWAP: " + AsText(vwapValue), Color.CYAN);
AddLabel(showPreviousClose, "Prev Close: " + AsText(prevCloseValue), Color.YELLOW);
AddLabel(showPivotPoints, "Pivot: " + AsText(pivotPoint), Color.MAGENTA);

# Proximity Alert
def distanceToVWAP = AbsValue(close - vwapValue);
def nearVWAP = distanceToVWAP < (ATR(14) * 0.3);
AddLabel(nearVWAP and showVWAP, "NEAR VWAP!", Color.ORANGE);

def distanceToPrevClose = AbsValue(close - prevCloseValue);
def nearPrevClose = distanceToPrevClose < (ATR(14) * 0.3);
AddLabel(nearPrevClose and showPreviousClose, "NEAR PREV CLOSE!", Color.ORANGE);

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.

MAGNET LEVELS - Price Attraction Zones

This indicator shows you the key levels where stocks "magnetize" or gravitate toward throughout the trading day. Think of these as gravity points that pull price back repeatedly.

What You'll See:

  • VWAP (Cyan line) - The strongest intraday magnet. Price bounces back to this level multiple times per day. When stocks move away from VWAP, they usually snap back.
  • Previous Day Close (Yellow dashed line) - Where the stock closed yesterday. This is a MAJOR retest level - the market has "memory" and loves to revisit this price.
  • Pivot Points (Magenta center, Green/Red lines) - Classic support and resistance magnets calculated from yesterday's high/low/close. Price tends to bounce between S1 and R1 most days.
  • Opening Range High/Low (Light green/red) - The first 30 minutes of trading creates a range. Price often returns to test these levels later in the day.
  • Round Numbers (Gray dots) - Psychological levels at $5 intervals ($600, $605, $610, etc.). Big money and options traders cluster orders at these whole numbers.

Orange Alerts flash when price gets close to VWAP or Previous Close - that's when the magnetic action happens!

How to Use It: Watch for price to approach these levels, then look for retests, bounces, or breakouts. Stocks don't move randomly - they move between these known magnet zones.

Sponsored

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.

NiceBreakout

Free trading indicator code and market insights for traders worldwide.

© 2025 NiceBreakout.com. All rights reserved.

Disclaimer: Trading insights are for informational purposes only and not financial advice.