Pivot Confirmation Indicator for ThinkorSwim

J007RMC

Well-known member
2019 Donor
Kind of like this script

Code:
# PivotConfirmationScanPlot_JQ
# based on
# Pivot Confirmation Scan
# Nube 12.26.19
#set scan for PivotConfirmation is true

# 01.02.2020  JQ added the bear side, changed some variable names because he is old and can't remember squat, made the arrows bigger because he can't see, and added alerts just because.

# Universals
def vOpen = open;
def vHigh = high;
def vLow = low;
def vClose = close;
def vVWAP = vwap;
def x = BarNumber();


# Bull Pivot and confirmation
input lowerThanPastBarsLength = 5;#hint n: For pivot


def lowestLow = vLow == Lowest(vLow, lowerThanPastBarsLength);
def lowestLowX = if lowestLow then x else Double.NaN;
def lowestLowBar__ = if !IsNaN(lowestLowX) then x else lowestLowBar__[1];

def lowestPivotBarHigh__ = if !IsNaN(lowestLowX) then vHigh else lowestPivotBarHigh__[1];


def bullConfirmation_Count = if lowestLow then 0 else
                         if  x - lowestLowBar__ <= 4 and
                             vClose crosses above lowestPivotBarHigh__
                         then bullConfirmation_Count[1] + 1
                         else bullConfirmation_Count[1];

plot bullPivotConfirmed = bullConfirmation_Count crosses above 0;
bullPivotConfirmed.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullPivotConfirmed.SetDefaultColor(Color.UPTICK);
bullPivotConfirmed.SetLineWeight(2);
alert ( bullPivotConfirmed, " Bull Pivot Confirmed ", alert.BAR, Sound.Chimes);

# Bear Pivot and confirmation
input higherThanPastBarsLength = 5;#hint n: For pivot
def highestHigh = vHigh == Highest(vHigh, higherThanPastBarsLength);
def highestHighX = if highestHigh then x else Double.NaN;
def highestHighBar__ = if !IsNaN(highestHighX) then x else highestHighBar__[1];

def highestPivotBarLow__ = if !IsNaN(highestHighX) then vLow else highestPivotBarLow__[1];

def bearConfirmation_Count = if highestHigh then 0 else
                         if  x - highestHighBar__ <= 4 and
                             vClose crosses below highestPivotBarLow__
                         then bearConfirmation_Count[1] + 1
                         else bearConfirmation_Count[1];

plot bearPivotConfirmed = bearConfirmation_Count crosses above 0;
bearPivotConfirmed.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearPivotConfirmed.SetDefaultColor(Color.DOWNTICK);
bearPivotConfirmed.SetLineWeight(2);
alert ( bearPivotConfirmed, " Bear Pivot Confirmed ", alert.BAR, Sound.Chimes);

# That's All Folks !
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thank you for your contribution helping those who desire to learn how to help themselves for understanding & coding thinkscript for themselves. Does your sample Pivot confirmation code here alert either a bullish or bearish directional Pivot via sound only; visual only or both?

I'll stop with that basic question; don't want to get to ahead of myself. I learn best taking baby steps. Thank you.
 
Hello Experts - Can we add one text to the pivots please -- Time Summation for the pivot.

Say pivot was made at 9:33 ( Just use hour and minutes) - Then add Hour and minute digits = here example is 9+3+3 = 15 so plot 15 below or above the pivot depending on it if was low or high pivot.
 
Kind of like this script

Code:
# PivotConfirmationScanPlot_JQ
# based on
# Pivot Confirmation Scan
# Nube 12.26.19
#set scan for PivotConfirmation is true

# 01.02.2020  JQ added the bear side, changed some variable names because he is old and can't remember squat, made the arrows bigger because he can't see, and added alerts just because.

# Universals
def vOpen = open;
def vHigh = high;
def vLow = low;
def vClose = close;
def vVWAP = vwap;
def x = BarNumber();


# Bull Pivot and confirmation
input lowerThanPastBarsLength = 5;#hint n: For pivot


def lowestLow = vLow == Lowest(vLow, lowerThanPastBarsLength);
def lowestLowX = if lowestLow then x else Double.NaN;
def lowestLowBar__ = if !IsNaN(lowestLowX) then x else lowestLowBar__[1];

def lowestPivotBarHigh__ = if !IsNaN(lowestLowX) then vHigh else lowestPivotBarHigh__[1];


def bullConfirmation_Count = if lowestLow then 0 else
                         if  x - lowestLowBar__ <= 4 and
                             vClose crosses above lowestPivotBarHigh__
                         then bullConfirmation_Count[1] + 1
                         else bullConfirmation_Count[1];

plot bullPivotConfirmed = bullConfirmation_Count crosses above 0;
bullPivotConfirmed.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullPivotConfirmed.SetDefaultColor(Color.UPTICK);
bullPivotConfirmed.SetLineWeight(2);
alert ( bullPivotConfirmed, " Bull Pivot Confirmed ", alert.BAR, Sound.Chimes);

# Bear Pivot and confirmation
input higherThanPastBarsLength = 5;#hint n: For pivot
def highestHigh = vHigh == Highest(vHigh, higherThanPastBarsLength);
def highestHighX = if highestHigh then x else Double.NaN;
def highestHighBar__ = if !IsNaN(highestHighX) then x else highestHighBar__[1];

def highestPivotBarLow__ = if !IsNaN(highestHighX) then vLow else highestPivotBarLow__[1];

def bearConfirmation_Count = if highestHigh then 0 else
                         if  x - highestHighBar__ <= 4 and
                             vClose crosses below highestPivotBarLow__
                         then bearConfirmation_Count[1] + 1
                         else bearConfirmation_Count[1];

plot bearPivotConfirmed = bearConfirmation_Count crosses above 0;
bearPivotConfirmed.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearPivotConfirmed.SetDefaultColor(Color.DOWNTICK);
bearPivotConfirmed.SetLineWeight(2);
alert ( bearPivotConfirmed, " Bear Pivot Confirmed ", alert.BAR, Sound.Chimes);

# That's All Folks !
@J007RMC thanks for bring this out to our attention. very nice. anyone what to pair this up with a confirmation or entry indicator?
 
Thank you for your contribution helping those who desire to learn how to help themselves for understanding & coding thinkscript for themselves. Does your sample Pivot confirmation code here alert either a bullish or bearish directional Pivot via sound only; visual only or both?

I'll stop with that basic question; don't want to get to ahead of myself. I learn best taking baby steps. Thank you.
If you open the study using the the customize icon, you will see it has audible alerts than can be toggled on and off.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
562 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