- Desktop
- Scripting
- Formulas and Scripting Functions
- Pivot() Function
Pivot() Function
The Pivot function uses the same functionality as the Pivot Labels tool to identify turning points in either a price chart or an indicator.
To calculate the value of the last confirmed 15 bar pivot high, and show in a watchlist column or Show Plot:
//Define the pivot criteriaV1 = PIVOT(MIN=15, TYPE=High, IGNOREUNCONFIRMED=True);//Get the high price when the last V1 pivot occurredVALUEWHEN(HIGH(), V1)
To scan for when the closing price crosses below a confirmed 10 bar pivot low:
//Define the pivot criteriaV1=PIVOT(MIN=10, TYPE=Low, IGNOREUNCONFIRMED=True);//Get the low price when the last V1 pivot occurredV2=VALUEWHEN(LOW(), V1);CLOSE() CrossesBelow V2To highlight on a the price chart when the RSI(14) has a 20 bar pivot low using a Show Bar (note pivot lows have a negative number, so need to be below 0 to be true):
PIVOT(RSI(BARS=14),MIN=15, TYPE=Low)Blog Posts
Section titled “Blog Posts”See these blog posts on using the Pivot function to find breakouts and divergences:
Your privacy choices
We use cookies and similar technologies to make the site work, see how it's used, and improve it. Analytics and advertising cookies only run with your consent — see our Privacy Policy for details.