Excluding bars from previous exited positions

How to script the Highest High or Lowest Low for bars AFTER the previous position was closed?

the syntax for Highest high value is HHV(14) and lowest Low value is LLV(14)

the condition of previous close position can not be defined from charts.

can you please elaborate?