Hi Pete,
This code idea is taken from your previous solutions. I am not getting the correct values if I select the start time 1800- when future opens.
input StartTime = 1800;
input EndTime = 859;
input StartDate= 20190116;
input EndDate = 20190117;
input labelText = ” HL2ForSelectedPeriod “;
def PivotPeriodstart = SecondsFromTime(StartTime );
def PivotPeriodstartEnd = SecondsTillTime(EndTime );
def PivotPeriodstartDate = DaysFromDate(StartDate);
def PivotPeriodendDate = DaysTillDate(EndDate);
def startOfPivotPeriod = PivotPeriodstartDate >= 0 and PivotPeriodstart >= 0;
def endOfPivotPeriod = PivotPeriodendDate >= 0 and PivotPeriodstartEnd >= 0;
rec PivotPeriod = if startOfPivotPeriod then yes else if endOfPivotPeriod [1] then no else PivotPeriod[1];
rec trackHighPivotPeriod = if PivotPeriod and !PivotPeriod [1] then high else if PivotPeriod and high > trackHighPivotPeriod [1] then high else trackHighPivotPeriod [1];
rec trackLowPivotPeriod = if PivotPeriod and !PivotPeriod [1] then low else if low > 0 and PivotPeriod and low < trackLowPivotPeriod [1] then low else trackLowPivotPeriod [1];
def HL2ForSelectedPeriod = Round((trackHighPivotPeriod + trackLowPivotPeriod ) / 2, 2);
AddLabel(yes, Concat(labelText, HL2ForSelectedPeriod), Color.magenta);
Thank you,
Shaishav
Like this:
Like Loading...