• Get $40 off VIP by signing up for a free account! Sign Up

Waynes Pivots For ThinkOrSwim

suretrade

New member
I have seen Wayne Mcdonnel use these for many years. He is on Youtube every morning Forex.today teaching people how to trade. Waynes Pivots are the best I have seen.

M2 and M4 are Buy and Sell zones that sends an alert to you when hit.
The colored areas at the top and bottom are take profit zones.

I don't know how it works, but it is different from other PP in the way it plots, and it works very well.
You should watch one of Waynes Youtube vids and see why it's an awesome tool to have.

jFvsIHQ.png



Here is the link https://www.tradingview.com/script/ad0JJQkX-Wayne-s-Pivots/
 
Last edited by a moderator:
Has anyone done a script for Wyatts Pivots? Waynes Pivots on Tradeview is about the same thing.
Here is the link https://www.tradingview.com/script/ad0JJQkX-Wayne-s-Pivots/

I have seen Wayne Mcdonnel use these for many years. He is on Youtube every morning Forex.today teaching people how to trade. Waynes Pivots are the best I have seen.

Here is a link to an old version of Wyatts Pivots https://www.forexfactory.com/thread/538297-the-best-pivot-points-indicator-ever

In a search of the forum, I didnt see anything like it. Waynes Pivot plot pp and mid points like M1 M2 M3 and M4 and plots the future pivots as well. M2 and M4 are Buy and Sell zones that sends an alert to you when hit. The colored areas at the top and bottom are take profit zones. I dont know how it works but it is different than other PP in the way it plots and it works very well. You should watch one of Waynes Youtube vids and see why its an awesome tool to have. He has some other very cool tools that he uses as well. Thank you
find below.

CSS:
# This is a ToS indicator
#//@joebaus
#//Created and maintained by Josh Baus.
#//With contributions from Wim Van Ertvelde.
#study("Wayne's Pivots", shorttitle="Wayne's Pivots", overlay=true)
#// Pivot point bias drop down selection for bulish, bearish, and Out Of Position highlights.
# Converted by Sam4Cok@Samer800    - 04/2023
input biasInput = {"Bullish", "Bearish", "Out of Position", "Range", default "All"};    # "Pivot Point Bias"
input AutoTimeFrame = yes;
input inputTimeFrame = AggregationPeriod.DAY;
def na = Double.NaN;
#----- Color
DefineGlobalColor("plotColorS"  , Color.DARK_GREEN);
DefineGlobalColor("plotColorR"  , Color.DARK_RED);
DefineGlobalColor("plotColorP"  , Color.DARK_ORANGE);
DefineGlobalColor("plotColorSL" , Color.GREEN);
DefineGlobalColor("plotColorRL" , Color.RED);
DefineGlobalColor("plotColorPL" , Color.ORANGE);
#// Automaticly selects a daily, weekly, or monthly pivot point based on the timeframe being used.
#barssince(Condition) =>
script barssince {
    input Condition = 0;
    def barssince = if Condition then 1 else barssince[1] + 1;
    plot return = barssince;
}
def timeframe = GetAggregationPeriod();
def defaultTimeFrame = if timeframe < AggregationPeriod.FOUR_HOURS then AggregationPeriod.DAY else
                       if timeframe < AggregationPeriod.WEEK then AggregationPeriod.MONTH else
                       if timeframe < AggregationPeriod.QUARTER then AggregationPeriod.YEAR else AggregationPeriod.DAY;
#inputTimeFrame  = input(title="Time Frame", type=input.resolution, defval="")
def pResolution  = if AutoTimeFrame then defaultTimeFrame else inputTimeFrame;
#// Creating the "avg_resOffset" value to plot the future pivot points.
#f_avgDilationOf(pResolution)
script f_avgDilationOf {
    input pResolution = AggregationPeriod.DAY;
    def time = if pResolution < AggregationPeriod.FOUR_HOURS then GetDay() else
               if pResolution < AggregationPeriod.WEEK then GetMonth() else
               if pResolution < AggregationPeriod.QUARTER then GetYear() else GetDay();
    def b = barssince(time-time[1]);
    def cumTotal = TotalSum(if b == 0 then b[1] + 1 else 0);
    def cumCount = TotalSum(if b == 0 then 1 else 0);
    def f_avgDilationOf = cumTotal / cumCount;
    plot out = f_avgDilationOf;
}
def avg_Offset = Ceil(f_avgDilationOf(pResolution));
def avg_resOffset = if avg_Offset>0 then floor(avg_Offset) else if avg_Offset<0 then Ceil(avg_Offset) else 0;

AddLabel(1, f_avgDilationOf(pResolution), Color.WHITE);
#// Get the high, low, open, and close of the "pResolution" function for pivot point math.
def prevCloseHTF = close(Period = pResolution);
def prevOpenHTF  = open(Period = pResolution);
def prevHighHTF  = high(Period = pResolution);
def prevLowHTF   = low(Period = pResolution);

#// Math for pivot point levels
def pLevel = (prevHighHTF + prevLowHTF + prevCloseHTF) / 3;

def s1Level = pLevel * 2 - prevHighHTF;
def r1Level = pLevel * 2 - prevLowHTF;
def s2Level = pLevel - (r1Level - s1Level);
def r2Level = (pLevel - s1Level) + r1Level;
def s3Level = prevLowHTF - 2.0 * (prevHighHTF - pLevel);
def r3Level = prevHighHTF + 2.0 * (pLevel - prevLowHTF);

def m2Level = pLevel - (pLevel - s1Level) / 2;
def m3Level = pLevel + (r1Level - pLevel) / 2;
def m1Level = s1Level - (s1Level - s2Level) / 2;
def m4Level = r1Level + (r2Level - r1Level) / 2;

#/ Bool conditions for bias settings
def bullBias;# = false
def bearBias;# = false
def oopBias;# = false
def rangeBias;# = false
def allBias;# = false

#/ Bool tree for bias settings
if biasInput == biasInput."Bullish" {
    rangeBias = no;
    bullBias = yes;
    bearBias = no;
    oopBias = no;
    allBias = no;
} else
if biasInput == biasInput."Bearish" {
    rangeBias = no;
    bullBias = no;
    bearBias = yes;
    oopBias = no;
    allBias = no;
} else
if biasInput == biasInput."Out of Position" {
    rangeBias = no;
    bullBias = no;
    bearBias = no;
    oopBias = yes;
    allBias = no;
} else
if biasInput == biasInput."Range" {
    rangeBias = yes;
    bullBias = no;
    bearBias = no;
    oopBias = no;
    allBias = no;
} else
if biasInput == biasInput."All" {
    rangeBias = no;
    bullBias = no;
    bearBias = no;
    oopBias = no;
    allBias = yes;
} else {
    rangeBias = rangeBias[1];
    bullBias = bullBias[1];
    bearBias = bearBias[1];
    oopBias = oopBias[1];
    allBias = allBias[1];
}
#// The indicator's pivot point plots. Pivot level stylization, used for buy and sell zone fills, biased pivots settings, and a gap or breakline "()!=0?na:" between pivots is here.
plot r2Plot = if bullBias or oopBias or allBias then r2Level[1] else na; # "R2"
r2Plot.SetDefaultColor(GlobalColor("plotColorR"));
plot m4Plot = if bullBias or oopBias or allBias then m4Level[1] else na;  # "M4"
m4Plot.SetDefaultColor(GlobalColor("plotColorR"));
plot r1Plot = if rangeBias or allBias then r1Level[1] else na;    #  "R1"
r1Plot.SetDefaultColor(GlobalColor("plotColorRL"));
plot m3Plot = if bearBias or allBias then m3Level[1] else na;    # "M3"
m3Plot.SetDefaultColor(GlobalColor("plotColorR"));

plot pPlot = if bullBias or bearBias or oopBias or rangeBias or allBias then pLevel[1] else na;     #  "PP"
pPlot.SetDefaultColor(GlobalColor("plotColorP"));

plot m2Plot = if bullBias or allBias then m2Level[1] else na;    # "M2"
m2Plot.SetDefaultColor(GlobalColor("plotColorS"));
plot s1Plot = if rangeBias or allBias then s1Level[1] else na;    # "S1"
s1Plot.SetDefaultColor(GlobalColor("plotColorSL"));
plot m1Plot = if bearBias or oopBias or allBias then m1Level[1] else na;    # "M1"
m1Plot.SetDefaultColor(GlobalColor("plotColorS"));
plot s2Plot = if bearBias or oopBias or allBias then s2Level[1] else na;   # "S2"
s2Plot.SetDefaultColor(GlobalColor("plotColorS"));

r2Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
m4Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
r1Plot.SetPaintingStrategy(PaintingStrategy.DASHES);
m3Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

pPlot.SetPaintingStrategy(PaintingStrategy.POINTS);

m2Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s1Plot.SetPaintingStrategy(PaintingStrategy.DASHES);
m1Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s2Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

AddCloud (r2Plot, m4Plot, CreateColor(39,0,0));
AddCloud (m3Plot, pPlot , CreateColor(39,0,0));
AddCloud (m1Plot, s2Plot, CreateColor(0,39,0));
AddCloud (pPlot, m2Plot , CreateColor(0,39,0));

#--- END Of Code
 
Last edited by a moderator:
find below.

CSS:
#https://www.tradingview.com/v/ad0JJQkX/
#//@joebaus
#//Created and maintained by Josh Baus.
#//With contributions from Wim Van Ertvelde.
#study("Wayne's Pivots", shorttitle="Wayne's Pivots", overlay=true)
#// Pivot point bias drop down selection for bulish, bearish, and Out Of Position highlights.
# Converted by Sam4Cok@Samer800    - 04/2023
input biasInput = {"Bullish", "Bearish", "Out of Position", "Range", default "All"};    # "Pivot Point Bias"
input AutoTimeFrame = yes;
input inputTimeFrame = AggregationPeriod.DAY;
def na = Double.NaN;
#----- Color
DefineGlobalColor("plotColorS"  , Color.DARK_GREEN);
DefineGlobalColor("plotColorR"  , Color.DARK_RED);
DefineGlobalColor("plotColorP"  , Color.DARK_ORANGE);
DefineGlobalColor("plotColorSL" , Color.GREEN);
DefineGlobalColor("plotColorRL" , Color.RED);
DefineGlobalColor("plotColorPL" , Color.ORANGE);
#// Automaticly selects a daily, weekly, or monthly pivot point based on the timeframe being used.
#barssince(Condition) =>
script barssince {
    input Condition = 0;
    def barssince = if Condition then 1 else barssince[1] + 1;
    plot return = barssince;
}
def timeframe = GetAggregationPeriod();
def defaultTimeFrame = if timeframe < AggregationPeriod.FOUR_HOURS then AggregationPeriod.DAY else
                       if timeframe < AggregationPeriod.WEEK then AggregationPeriod.MONTH else
                       if timeframe < AggregationPeriod.QUARTER then AggregationPeriod.YEAR else AggregationPeriod.DAY;
#inputTimeFrame  = input(title="Time Frame", type=input.resolution, defval="")
def pResolution  = if AutoTimeFrame then defaultTimeFrame else inputTimeFrame;
#// Creating the "avg_resOffset" value to plot the future pivot points.
#f_avgDilationOf(pResolution)
script f_avgDilationOf {
    input pResolution = AggregationPeriod.DAY;
    def time = if pResolution < AggregationPeriod.FOUR_HOURS then GetDay() else
               if pResolution < AggregationPeriod.WEEK then GetMonth() else
               if pResolution < AggregationPeriod.QUARTER then GetYear() else GetDay();
    def b = barssince(time-time[1]);
    def cumTotal = TotalSum(if b == 0 then b[1] + 1 else 0);
    def cumCount = TotalSum(if b == 0 then 1 else 0);
    def f_avgDilationOf = cumTotal / cumCount;
    plot out = f_avgDilationOf;
}
def avg_Offset = Ceil(f_avgDilationOf(pResolution));
def avg_resOffset = if avg_Offset>0 then floor(avg_Offset) else if avg_Offset<0 then Ceil(avg_Offset) else 0;

AddLabel(1, f_avgDilationOf(pResolution), Color.WHITE);
#// Get the high, low, open, and close of the "pResolution" function for pivot point math.
def prevCloseHTF = close(Period = pResolution);
def prevOpenHTF  = open(Period = pResolution);
def prevHighHTF  = high(Period = pResolution);
def prevLowHTF   = low(Period = pResolution);

#// Math for pivot point levels
def pLevel = (prevHighHTF + prevLowHTF + prevCloseHTF) / 3;

def s1Level = pLevel * 2 - prevHighHTF;
def r1Level = pLevel * 2 - prevLowHTF;
def s2Level = pLevel - (r1Level - s1Level);
def r2Level = (pLevel - s1Level) + r1Level;
def s3Level = prevLowHTF - 2.0 * (prevHighHTF - pLevel);
def r3Level = prevHighHTF + 2.0 * (pLevel - prevLowHTF);

def m2Level = pLevel - (pLevel - s1Level) / 2;
def m3Level = pLevel + (r1Level - pLevel) / 2;
def m1Level = s1Level - (s1Level - s2Level) / 2;
def m4Level = r1Level + (r2Level - r1Level) / 2;

#/ Bool conditions for bias settings
def bullBias;# = false
def bearBias;# = false
def oopBias;# = false
def rangeBias;# = false
def allBias;# = false

#/ Bool tree for bias settings
if biasInput == biasInput."Bullish" {
    rangeBias = no;
    bullBias = yes;
    bearBias = no;
    oopBias = no;
    allBias = no;
} else
if biasInput == biasInput."Bearish" {
    rangeBias = no;
    bullBias = no;
    bearBias = yes;
    oopBias = no;
    allBias = no;
} else
if biasInput == biasInput."Out of Position" {
    rangeBias = no;
    bullBias = no;
    bearBias = no;
    oopBias = yes;
    allBias = no;
} else
if biasInput == biasInput."Range" {
    rangeBias = yes;
    bullBias = no;
    bearBias = no;
    oopBias = no;
    allBias = no;
} else
if biasInput == biasInput."All" {
    rangeBias = no;
    bullBias = no;
    bearBias = no;
    oopBias = no;
    allBias = yes;
} else {
    rangeBias = rangeBias[1];
    bullBias = bullBias[1];
    bearBias = bearBias[1];
    oopBias = oopBias[1];
    allBias = allBias[1];
}
#// The indicator's pivot point plots. Pivot level stylization, used for buy and sell zone fills, biased pivots settings, and a gap or breakline "()!=0?na:" between pivots is here.
plot r2Plot = if bullBias or oopBias or allBias then r2Level[1] else na; # "R2"
r2Plot.SetDefaultColor(GlobalColor("plotColorR"));
plot m4Plot = if bullBias or oopBias or allBias then m4Level[1] else na;  # "M4"
m4Plot.SetDefaultColor(GlobalColor("plotColorR"));
plot r1Plot = if rangeBias or allBias then r1Level[1] else na;    #  "R1"
r1Plot.SetDefaultColor(GlobalColor("plotColorRL"));
plot m3Plot = if bearBias or allBias then m3Level[1] else na;    # "M3"
m3Plot.SetDefaultColor(GlobalColor("plotColorR"));

plot pPlot = if bullBias or bearBias or oopBias or rangeBias or allBias then pLevel[1] else na;     #  "PP"
pPlot.SetDefaultColor(GlobalColor("plotColorP"));

plot m2Plot = if bullBias or allBias then m2Level[1] else na;    # "M2"
m2Plot.SetDefaultColor(GlobalColor("plotColorS"));
plot s1Plot = if rangeBias or allBias then s1Level[1] else na;    # "S1"
s1Plot.SetDefaultColor(GlobalColor("plotColorSL"));
plot m1Plot = if bearBias or oopBias or allBias then m1Level[1] else na;    # "M1"
m1Plot.SetDefaultColor(GlobalColor("plotColorS"));
plot s2Plot = if bearBias or oopBias or allBias then s2Level[1] else na;   # "S2"
s2Plot.SetDefaultColor(GlobalColor("plotColorS"));

r2Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
m4Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
r1Plot.SetPaintingStrategy(PaintingStrategy.DASHES);
m3Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

pPlot.SetPaintingStrategy(PaintingStrategy.POINTS);

m2Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s1Plot.SetPaintingStrategy(PaintingStrategy.DASHES);
m1Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s2Plot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

AddCloud (r2Plot, m4Plot, CreateColor(39,0,0));
AddCloud (m3Plot, pPlot , CreateColor(39,0,0));
AddCloud (m1Plot, s2Plot, CreateColor(0,39,0));
AddCloud (pPlot, m2Plot , CreateColor(0,39,0));

#--- END Of Code

The script is running very slowly for me when using a longer time span on the chart, such as a year. Is it possible to modify the script so that it only plots back 60 days (even if the chart date range is over 60 days), so that the plot can be viewed for the most recent two months (plus tomorrow's projected pivots) without consuming a lot of bandwidth?
 
How do I get the weekly and monthly Pivots to all plot together like Wayne uses? When I load template it only loads the monthly Pivots. Is there another script maybe?
 
How do I get the weekly and monthly Pivots to all plot together like Wayne uses? When I load template it only loads the monthly Pivots. Is there another script maybe?

You can load the indicator multiple times.
Change the timeframe in settings:
input inputTimeFrame = AggregationPeriod.DAY;
 

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