MTF Floor Trader Pivots For ThinkOrSwim

cando13579

Active member
VIP
mod note:
Calculates classic floor‑trader pivot levels using 4‑hour candles, then projects those levels onto any intraday chart.

A day trader wants 4‑hour levels because they give a clean, higher‑timeframe map that doesn’t flicker or recalc intraday, letting you instantly see where price is likely to react, stall, or break with conviction. They act as stable decision zones—helping you avoid bad entries directly into support or resistance, time exits more cleanly, and judge strength or weakness without adding noise or clutter to the chart.
UzdWeZ2.png


Plot NameLevel TypeMeaningColor
PivotLinebrkPivot (P)Central reference level from prior 4H candleYellow
Res1LineR1First resistance above pivotRed
Res2LineR2Second resistance above pivotRed
Res3LineR3Third resistance above pivotRed
Res4LineR4Fourth resistance above pivotRed
Sup1LineS1First support below pivotGreen
Sup2LineS2Second support below pivotGreen
Sup3LineS3Third support below pivotGreen
Sup4LineS4Fourth support below pivotGreen


Code:
# ===== 4 hour levels=====
def showP  = 1;
def showSR = 1;

# ===== 4H DATA =====
def agg = AggregationPeriod.FOUR_HOURS;

def h4H = high(period = agg);
def h4L = low(period = agg);
def h4C = close(period = agg);

def new4H = h4H != h4H[1];

rec piv;
rec r1v;
rec r2v;
rec r3v;
rec r4v;
rec s1v;
rec s2v;
rec s3v;
rec s4v;

if new4H then {
    piv = (h4H[1] + h4L[1] + h4C[1]) / 3;
    r1v = 2 * piv - h4L[1];
    r2v = piv + (h4H[1] - h4L[1]);
    r3v = h4H[1] + 2 * (piv - h4L[1]);
    r4v = r3v + (h4H[1] - h4L[1]);
    s1v = 2 * piv - h4H[1];
    s2v = piv - (h4H[1] - h4L[1]);
    s3v = h4L[1] - 2 * (h4H[1] - piv);
    s4v = s3v - (h4H[1] - h4L[1]);
} else {
    piv = piv[1];
    r1v = r1v[1];
    r2v = r2v[1];
    r3v = r3v[1];
    r4v = r4v[1];
    s1v = s1v[1];
    s2v = s2v[1];
    s3v = s3v[1];
    s4v = s4v[1];
}

# ===== PLOTS =====
plot PivotLinebrk = if showP then piv else Double.NaN;
plot Res1Line = if showSR then r1v else Double.NaN;
plot Res2Line = if showSR then r2v else Double.NaN;
plot Res3Line = if showSR then r3v else Double.NaN;
plot Res4Line = if showSR then r4v else Double.NaN;
plot Sup1Line = if showSR then s1v else Double.NaN;
plot Sup2Line = if showSR then s2v else Double.NaN;
plot Sup3Line = if showSR then s3v else Double.NaN;
plot Sup4Line = if showSR then s4v else Double.NaN;

# ===== COLOR &  STYLES=====
PivotLinebrk.SetDefaultColor(Color.YELLOW);
PivotLinebrk.SetPaintingStrategy(PaintingStrategy.POINTS);

Res1Line.SetDefaultColor(Color.RED);
Res1Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Res2Line.SetDefaultColor(Color.RED);
Res2Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Res3Line.SetDefaultColor(Color.RED);
Res3Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Res4Line.SetDefaultColor(Color.RED);
Res4Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Sup1Line.SetDefaultColor(Color.GREEN);
Sup1Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Sup2Line.SetDefaultColor(Color.GREEN);
Sup2Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Sup3Line.SetDefaultColor(Color.GREEN);
Sup3Line.SetPaintingStrategy(PaintingStrategy.POINTS);

Sup4Line.SetDefaultColor(Color.GREEN);
Sup4Line.SetPaintingStrategy(PaintingStrategy.POINTS);
 
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
1933 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