title: getting previous week highs and lows using 30 min data in Trading View pine
body: <p>In Trading view I want to write pine script to find the highest from column high and lowest from column low for ever past week(.ie like group for every previous view) Like i am calculating today so previous week high and low is marked in the yellow of attached image.
  Below are the desired output</p>
  <ol>
  <li><p>Looking for last week (ie from 11th july 22 to 15th july 22) and get the low related to the 30min highest high. which occurred on 12-07-2022 09:15:00</p>
  </li>
  <li><p>A new column which populates all the low for last week(30 min interval) with the values 369.2 (green in color) for this week and 370.05(Orange in color) for last week (Whose value is derived as low of the 30min highest high of week 4th july to 8th july).</p>
  </li>
  <li><p>For the whole last week 30 min highest high is 376.25 and its corresponding low is 369.2 which needs to be populated for the this df[&quot;Previous week corresponding low of the 30min highest high&quot;]
  Hope i am bit more clear on the output. I know its bit complex requirement. Desired output shown in 4th column <a href="https://i.stack.imgur.com/NTXQ9.png" rel="nofollow noreferrer">&quot;Previous week corresponding low of the 30min highest high&quot;</a></p>
  </li>
  </ol>