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: