Using Pivot Labels to determine significant highs and lows

The Pivot Labels tool can be used to determine significant support and resistance levels.

This script calculates when a 10 period pivot high or low is taken out:

Updated script to reflect the changes made in Optuma 1.6

//High pivot settings
V1=PIVOT(MIN=10, TYPE=High, IGNOREUNCONFIRMED=True);
//Get high value when pivot occurred
V2=VALUEWHEN(HIGH(),V1);
//Low pivot settings
V3=PIVOT(MIN=10, TYPE=Low, IGNOREUNCONFIRMED=True);
//Get low value when pivot occurred
V4=VALUEWHEN(LOW(),V3);
//Get signals
CLOSE() CrossesAbove V2[1] or 
CLOSE() CrossesBelow V4[1]

Capture

The Pivot Label levels can be plotted on a chart using a Show Plot tool. This example will draw the value of the 15 bar high levels:

V1=PIVOT(MIN=15, TYPE=High, IGNOREUNCONFIRMED=True);
VALUEWHEN(HIGH(), V1))

Capture

More examples on scanning for these levels here:

https://www.optuma.com/finding-breakouts/

The following is an update to the original script to improve accuracy of the breakouts. For example, the original script would have triggered on the last bar in the example below because the closing price crossed from below the pivot level to above, but it ignores all the bars in the in the orange box:
Capture

This version only triggers if the closing price crosses the pivot level value and also sets a new closing high since the pivot occurred:

//Define pivots;
#$Bars=10;
H1=PIVOT(MIN=$Bars, TYPE=High, IGNOREUNCONFIRMED=True);
L1=PIVOT(MIN=$Bars, TYPE=Low, IGNOREUNCONFIRMED=True);
//Get pivot values;
H2=VALUEWHEN(HIGH(), H1);
L2=VALUEWHEN(LOW(),L1);
//When did the pivots occur?;
$TH1=TIMESINCESIGNAL(H1, UNIT=Bars);
$TL1=TIMESINCESIGNAL(L1, UNIT=Bars);
//Close crosses previous pivot level with new closing high/low since the pivot;
(CLOSE() CrossesAbove H2 and CLOSE() > HIGHESTHIGH(CLOSE(),BARS=$TH1)) or
(CLOSE() CrossesBelow L2 and CLOSE() < LOWESTLOW(CLOSE(),BARS=$TL1))