Greetings all,

I am trying to plot the premarket high , low and close for 3 minute aggregation period. I came up with the following plot but am a bit unsure if I did the closing price for the 3 minute premarket correctly. Please advice if the following code is right for pre -market high, low and closing plot for 3 minute aggregation.

Thank you very much

I am trying to plot the premarket high , low and close for 3 minute aggregation period. I came up with the following plot but am a bit unsure if I did the closing price for the 3 minute premarket correctly. Please advice if the following code is right for pre -market high, low and closing plot for 3 minute aggregation.

Thank you very much

Code:

```
#Pre market high, low and close for 3 minute aggregation
input startTime = 400;
input endTime = 929;
def timeUntilClose = SecondsTillTime(endTime);
def timeUntilOpen = SecondsTillTime(startTime);
def targetPeriod = timeUntilClose > 0;
rec targetPeriodHigh = if targetPeriod and !targetPeriod[1] then high(period = aggregationPeriod.THREE_MIN) else if targetPeriod and high(period = aggregationPeriod.THREE_MIN) > targetPeriodHigh[1] then high(period = aggregationPeriod.THREE_MIN) else targetPeriodHigh[1];
rec targetPeriodLow = if targetPeriod and !targetPeriod[1] then low(period = aggregationPeriod.THREE_MIN) else if targetPeriod and low(period = aggregationPeriod.THREE_MIN) < targetPeriodLow[1] and low(period = aggregationPeriod.THREE_MIN) > 0 then low(period = aggregationPeriod.THREE_MIN) else targetPeriodLow[1];
rec targetPeriodclose = if targetPeriod and !targetPeriod[1] then close(period = aggregationPeriod.THREE_MIN) else targetPeriodclose[1];
plot pmHigh = targetPeriodHigh;
plot pmLow = targetPeriodLow;
plot pmclose = targetPeriodclose;
```

Last edited: