I am working on a TOS script for a scanner and stuck on Retrieving the Lowest low within a specified period after Highest High is captured in the specified period, please see code below: Will appreciate help in obtaining lowAfterHigh
input periodStartEST = 0930;
input periodEndEST = 1200;
# Define some variables to identify the start and end of the period
def periodStart = if secondsTillTime(periodStartEST) <=0 and secondsTillTime(periodStartEST)[1] > 0 then 1 else 0;
def periodEnd = if secondsTillTime(periodEndEST) <=0 and secondsTillTime(periodEndEST)[1] > 0 then 1 else 0;
# Define variables to identify the period as a whole
def inPeriod = if periodStart then 1 else if periodEnd then 0 else inPeriod[1];
def newPeriod = if periodStart then 1 else 0;
# Capture the high, low, and open only within the period. Reset when a new period starts
def highOfPeriod = if newPeriod then high else if inPeriod then if high > highOfPeriod[1] then high else highOfPeriod[1] else highOfPeriod[1];
def lowOfPeriod = if newPeriod then low else if inPeriod then if low < lowOfPeriod[1] then low else lowOfPeriod[1] else lowOfPeriod[1];
def openOfPeriod = if newPeriod then open else openOfPeriod[1];
#capture the low/lowest that occurs after highofperiod --this is where i need help
def lowAfterHigh = ?????
Thanks
input periodStartEST = 0930;
input periodEndEST = 1200;
# Define some variables to identify the start and end of the period
def periodStart = if secondsTillTime(periodStartEST) <=0 and secondsTillTime(periodStartEST)[1] > 0 then 1 else 0;
def periodEnd = if secondsTillTime(periodEndEST) <=0 and secondsTillTime(periodEndEST)[1] > 0 then 1 else 0;
# Define variables to identify the period as a whole
def inPeriod = if periodStart then 1 else if periodEnd then 0 else inPeriod[1];
def newPeriod = if periodStart then 1 else 0;
# Capture the high, low, and open only within the period. Reset when a new period starts
def highOfPeriod = if newPeriod then high else if inPeriod then if high > highOfPeriod[1] then high else highOfPeriod[1] else highOfPeriod[1];
def lowOfPeriod = if newPeriod then low else if inPeriod then if low < lowOfPeriod[1] then low else lowOfPeriod[1] else lowOfPeriod[1];
def openOfPeriod = if newPeriod then open else openOfPeriod[1];
#capture the low/lowest that occurs after highofperiod --this is where i need help
def lowAfterHigh = ?????
Thanks