UPDATE - the description of the non repainting request security function was cut off in the orignal description. The correct code the reflects the function in the script is written below
f_secSecurity(_src, _res, _exp) =>
request.security(_src, _res, _exp[barstate.isrealtime ? 1: 0])[barstate.isrealtime ? 0: 1]
Also updated script to show pivot high/low when script is first loaded on the chart.