How do I obtain the HI or LOW value of a Premarket time frame?

jngy2k

Member
VIP
Most scans are done with a DAILY chart Aggregation. Using "high" or "low" will produce the value for the day desired such as high[1] for yesterday or high[2] for two days ago.

I'm trying to get the HIGHest value on a 1m chart Aggregation for the Premarket Time.

The bottom shows a scan for % change in Premarket comparing the last 1minute close price to the last close price of regular market hours.
Instead of obtaining last close premarket price I'm interested in the high price of premarket. And can someone explain what the compoundvalue script does in THIS SPECIFIC case?

Any ideas?

Code:
input closing_time = 1559;
input open_time = 0930;
input price = close;
input operator = {default "greater than","less than"};
input percent_change = 1.00;
def time_until_close = SecondsTillTime(closing_time);
def time_until_open = SecondsTillTime(open_time);
def closing_bell = time_until_close == 0;
rec closing_price = CompoundValue(1, if closing_bell then price else closing_price[1], price);
def after_closing_bell = time_until_close <= 0;
def before_opening_bell = time_until_open  >= 0  ;
def afterhours_percent_change = 100 * (price / closing_price - 1);
def meet_scan_criteria;
switch (operator) {
case "greater than":
    meet_scan_criteria = afterhours_percent_change >= percent_change;
case "less than":
    meet_scan_criteria = afterhours_percent_change <=  percent_change;
}
plot scan = (after_closing_bell or before_opening_bell) AND meet_scan_criteria;
 
Last edited:

jngy2k

Member
VIP
I believe the solution has to use either of the following scripts;
highest
getaggregation.min
or define the number of bars after the close and use that def in the formula high[barsafterclose]/closing_price
@BenTen quick help please
 

Similar threads

Top