# Floor Trader Pivot Points For ThinkOrSwim

#### KCLLive

##### New member
Hi, new user to TOS and ThinkScript, thanks in advance for any help you guys can offer. I'm trying to calculate floor trader pivot levels

Last edited by a moderator:
@KCLLive Haven't looked at your script any, but Mobius of the TSL coded Floor Trader Pivots for ThinkorSwim a decade ago. I'm certainly not trying to dissuade you from continuing your script - I think it very commendable that you are actively trying vs wanting others to do the coding. This may make it easier.

Code:
``````# Floor Traders pivots (can be used in scanner)
# Mobius
# V01.06.2011

def Today = GetDay() == GetLastDay();
def Yesterday = GetDay() == GetLastDay() - 1;
def last = if Today and !Today[1]
then close[1]
else last[1];
def prevHigh = if YesterDay and !YesterDay[1]
then high
else if Yesterday and
high > prevHigh[1]
then high
else prevHigh[1];
def prevLow = if Yesterday and !Yesterday[1]
then low
else if Yesterday and
low < prevLow[1]
then low
else prevLow[1];
def BubbleLocation = !yesterday and yesterday[1];

plot pHigh = prevHigh;
pHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pHigh.SetDefaultColor(color.dark_green);
AddChartBubble(BubbleLocation, prevHigh, "Prev High", Color.DARK_GRAY, no);
plot pLow = prevLow;
pLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pLow.SetDefaultColor(color.dark_red);
AddChartBubble(BubbleLocation, prevLow, "Prev low", Color.DARK_GRAY, no);
plot pivot = (prevHigh + prevLow + last) / 3;
pivot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pivot.SetDefaultColor(color.dark_gray);
plot R1 = Round(((2 * pivot) - prevLow) / TickSize(), 0) * TickSize();
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetDefaultColor(color.dark_gray);
plot S1 = Round(((2 * pivot) - prevHigh) / TickSize(), 0) * TickSize();
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetDefaultColor(color.dark_gray);
plot R2 = Round((pivot + (R1 - S1)) / TickSize(), 0) * TickSize();
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetDefaultColor(color.dark_gray);
plot S2 = Round((pivot - (R1 - S1)) / TickSize(), 0) * TickSize();
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetDefaultColor(color.dark_gray);
plot R3 = Round((prevHigh + (2 * (pivot - prevLow))) / TickSize(), 0) * TickSize();
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetDefaultColor(color.dark_gray);
plot S3 = Round((prevLow - (2 * (prevHigh - pivot))) / TickSize(), 0) * TickSize();
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetDefaultColor(color.dark_gray);
plot R4 = Round((prevHigh + (3 * (pivot - prevLow))) / TickSize(), 0) * TickSize();
R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetDefaultColor(color.dark_gray);
plot S4 = Round((prevLow - (3 * (prevHigh - pivot))) / TickSize(), 0) * TickSize();
S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.SetDefaultColor(color.dark_gray);
AddLabel(1, "Yesterdays Close = " + last,
if close > last then color.green
else if close == last then color.cyan
else color.red);

# Scan examples
# If you name this study "Floor_Trader_Pivots_Scan" you can reference the study in the scanner and scan for equities crossing above or below any of the plots using the format below.

# End Code Floor Trader Pivots``````

Last edited by a moderator:
@KCLLive Haven't looked at your script any, but Mobius of the TSL coded Floor Trader Pivots for ThinkorSwim a decade ago. I'm certainly not trying to dissuade you from continuing your script - I think it very commendable that you are actively trying vs wanting others to do the coding. This may make it easier.

Code:
``````# Floor Traders pivots (can be used in scanner)
# Mobius
# V01.06.2011

def Today = GetDay() == GetLastDay();
def Yesterday = GetDay() == GetLastDay() - 1;
def last = if Today and !Today[1]
then close[1]
else last[1];
def prevHigh = if YesterDay and !YesterDay[1]
then high
else if Yesterday and
high > prevHigh[1]
then high
else prevHigh[1];
def prevLow = if Yesterday and !Yesterday[1]
then low
else if Yesterday and
low < prevLow[1]
then low
else prevLow[1];
def BubbleLocation = !yesterday and yesterday[1];

plot pHigh = prevHigh;
pHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pHigh.SetDefaultColor(color.dark_green);
AddChartBubble(BubbleLocation, prevHigh, "Prev High", Color.DARK_GRAY, no);
plot pLow = prevLow;
pLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pLow.SetDefaultColor(color.dark_red);
AddChartBubble(BubbleLocation, prevLow, "Prev low", Color.DARK_GRAY, no);
plot pivot = (prevHigh + prevLow + last) / 3;
pivot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
pivot.SetDefaultColor(color.dark_gray);
plot R1 = Round(((2 * pivot) - prevLow) / TickSize(), 0) * TickSize();
R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R1.SetDefaultColor(color.dark_gray);
plot S1 = Round(((2 * pivot) - prevHigh) / TickSize(), 0) * TickSize();
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetDefaultColor(color.dark_gray);
plot R2 = Round((pivot + (R1 - S1)) / TickSize(), 0) * TickSize();
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetDefaultColor(color.dark_gray);
plot S2 = Round((pivot - (R1 - S1)) / TickSize(), 0) * TickSize();
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetDefaultColor(color.dark_gray);
plot R3 = Round((prevHigh + (2 * (pivot - prevLow))) / TickSize(), 0) * TickSize();
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetDefaultColor(color.dark_gray);
plot S3 = Round((prevLow - (2 * (prevHigh - pivot))) / TickSize(), 0) * TickSize();
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetDefaultColor(color.dark_gray);
plot R4 = Round((prevHigh + (3 * (pivot - prevLow))) / TickSize(), 0) * TickSize();
R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetDefaultColor(color.dark_gray);
plot S4 = Round((prevLow - (3 * (prevHigh - pivot))) / TickSize(), 0) * TickSize();
S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.SetDefaultColor(color.dark_gray);
AddLabel(1, "Yesterdays Close = " + last,
if close > last then color.green
else if close == last then color.cyan
else color.red);

# Scan examples
# If you name this study "Floor_Trader_Pivots_Scan" you can reference the study in the scanner and scan for equities crossing above or below any of the plots using the format below.

# End Code Floor Trader Pivots``````

If you ever need or want a script and can't find it here at UseThinkscript, try https://tinyurl.com/tsCommunity - its a OneNote kept up by Johnny Quotron of the TSL. There's far more codes there than anyone could ever use.
Hi, thanks for the code can you share this study via TOS?

To get valid Floor Trader Pivots on Monday, is there a modification to be able to use Friday's data when working on a Monday daily chart, rather than using no data and getting no Floor Trader Pivots or using Sunday night's limited data? Thanks.

Good afternoon!
I was working on updating floor trading pivots and im running in this issue with code plotting next day:

Is there a way to hide it if i want? I wrote input PlotNextDay but not sure how to apply it to this

Code:

input Timeframe = AggregationPeriod.DAY;
input ShowOnlyToday = YES;
input PlotNextDay = YES;
input price = FundamentalType.CLOSE;

#declare hide_on_daily;

#Cloud Color
defineGlobalColor("Cloud", Color.VIOLET);

def high = high(period = Timeframe);
def low = low(period = Timeframe);
def close = close(period = Timeframe);

plot PP;
plot LOD;
plot HOD;
plot BC;
plot TC;

#RESITANCES / SUPPORTS

plot R1;
plot R2;
plot R3;
plot R4;

plot S1;
plot S2;
plot S3;
plot S4;

if ShowOnlyToday and !IsNaN(close(period = Timeframe)[-2])

then {

PP = Double.NaN;
LOD = Double.NaN;
HOD = Double.NaN;
BC = Double.NaN;
TC = Double.NaN;

# RESISTANCES / SUPPORTS

R1 = Double.NaN;
R2 = Double.NaN;
R3 = Double.NaN;
R4 = Double.NaN;

S1 = Double.NaN;
S2 = Double.NaN;
S3 = Double.NaN;
S4 = Double.NaN;

} else {

PP = (high[1] + low[1] + close[1]) / 3;
LOD = low[1];
HOD = high[1];
BC = (high[1] + low[1]) / 2;
TC = (PP - BC) + PP;

# RESISTANCES / SUPPORTS

R1 = 2 * PP - low[1];
R2 = PP + (high[1] - low[1]);
R3 = R1 + (high[1] - low[1]);
R4 = R3 + (R2 - R1);

S1 = 2 * PP - high[1];
S2 = PP - (high[1] - low[1]);
S3 = S1 - (high[1] - low [1]);
S4 = S3 - (S1 - S2);

}

#PLOT LINES
PP.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LOD.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
HOD.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
BC.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
TC.setPaintingStrategy(PaintingStrategy.HORIZONTAL);

#SUPPORTS / RESISTANCES

R1.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.setPaintingStrategy(PaintingStrategy.HORIZONTAL);

S1.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.setPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.setPaintingStrategy(PaintingStrategy.HORIZONTAL);

PP.SetDefaultColor(color = Color.VIOLET);
LOD.SetDefaultColor(color = Color.LIGHT_ORANGE);
HOD.SetDefaultColor(color = Color.LIGHT_ORANGE);
BC.SetDefaultColor(color = Color.VIOLET);
TC.SetDefaultColor(color = Color.VIOLET);

R1.SetDefaultColor(color = Color.GRAY);
R2.SetDefaultColor(color = Color.GRAY);
R3.SetDefaultColor(color = Color.GRAY);
R4.SetDefaultColor(color = Color.GRAY);

S1.SetDefaultColor(color = Color.GRAY);
S2.SetDefaultColor(color = Color.GRAY);
S3.SetDefaultColor(color = Color.GRAY);
S4.SetDefaultColor(color = Color.GRAY);

#CLOUDS
AddCloud(BC, TC, color1 = globalColor("Cloud"), color2 = globalColor("Cloud"));

Thank you!

@GRINKT change the first line of your IF statement to this:
Ruby:
``if (ShowOnlyToday and !IsNaN(close(period = Timeframe)[-2])) or (!PlotNextDay and IsNaN(close(period = Timeframe)))``

@GRINKT change the first line of your IF statement to this:
Ruby:
``if (ShowOnlyToday and !IsNaN(close(period = Timeframe)[-2])) or (!PlotNextDay and IsNaN(close(period = Timeframe)))``

Appreciate that i was doing or statement inside first if so i couldnt get it to work...
If anyone wants this, here my version of floor pivots - http://tos.mx/HZG74pF

Last edited:
Appreciate that i was doing or statement inside first if so i couldnt get it to work...
If anyone wants this, here my version of floor pivots - http://tos.mx/HZG74pF
Hi, I've enjoyed trying out your script and it works well. I have used and modified a few scripts from here, but I have fairly limited coding ability to be honest. I wonder if you know how to add a label above each pivot line that stays at the far right edge of the window, as shown in the picture I've attached - this is a Ninjatrader script.

#### Attachments

• yesterday high correctly placed.png
387.8 KB · Views: 152

87k+ Posts
328 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?