# Tutorial 182 | Highest pivot within user input number of bars

Tutorial 182 demonstrates a EasyLanguage Show-me study that calculates the pivot with the highest value WITHIN a user input number of bars of the current bar (user input: LookbackBars). (N.B. This is different from finding the highest pivot value on the chart.)

The program works as follows: each time a pivot is found it is plotted. The bar number and the price level are stored in a dictionary.

At the end of each bar the dictionary is traversed and index/values pairs where the pivot occurred more than user input LookBackBars ago are deleted. The dictionary values are then copied into a vector (named Values) which is sorted to find the highest value using the Markplex _VectorQuickSort function. This value is plotted.

This tutorial does not work with MultiCharts.

Tutorial 182 demonstrates the use of the Dictionary and Vectors. It also uses the pivot function.

Tutorial 182 with a LookbackBars of 20

## Inputs

int LeftStrength( 3 ), // Left strength of pivot
int RightStrength( 3 ), // Right strength of pivot

int LookbackBars( 100 ); // Number of bars to examine to find the highest pivot value during that period

### Video explaining tutorial 182

Hopefully you can understand this tutorial and replicate it for your own use and education. If you want to save some time typing in the code then the Tutorial 182 program is available for  IMMEDIATE download for \$24.95  by clicking the following ‘add to cart’ button.  The download includes the _VectorQuickSort function.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.