Question about bar data manipulation

I need the time of the high and low of the current bar.

Snippet of the code:

If (d.close()==d.high())
{this.highTime=new Date().get minutes()} //For bar high time
If (d.close()==d.low())
{this.lowTime=new Date().get minutes()}//For bar low time

The issue is that when close is equal to low/high, exactly at that time, it works. But when close is not equal to low, it will not remember to save/store/push the value so that it can be used.

I feel like there is an easy script function that I am missing to store the value.