Hey guys, I'm hoping someone can point me in the right direction. It is probably something simple, but I can't seem to get it right. I currently have a study that compares the daily close with the previous day. It then is divided by the previous days close to calculate the percentage change between days. The math comes out as (Daily Close - Previous Daily Close) / Previous Daily Close. I would like to refine this to reference the close of a specific hourly candle where it would look like (1100am hourly close - Daily Close) / Previous Daily Close. The idea is to see how much the price moves as a percentage after the volatility subsides in the morning. I have attached the code that I have for what is currently working, however I'm lost as to how to reference the 1100am candles close. Any help would be greatly appreciated!
Code:
declare lower;
input hiAlert = 0.5;
input loAlert = -0.5;
input price = close;
plot PercentChg = (Close(period = AggregationPeriod.DAY)-Close(period = AggregationPeriod.DAY)[1])/Close(period = AggregationPeriod.DAY)[1]*100;
plot pHiAlert = hiAlert;
plot pLoAlert = loAlert;
PercentChg.DefineColor("HiAlert", (color.yellow));
PercentChg.DefineColor("Normal", GetColor(7));
PercentChg.DefineColor("LoAlert", (color.LIGHT_ORANGE));
PercentChg.AssignValueColor(
if PercentChg > hiAlert then PercentChg.color("HiAlert") else if PercentChg < loAlert then PercentChg.color("LoAlert")
else PercentChg.color("Normal"));
PercentChg.SetLineWeight(5);
pHiAlert.SetDefaultColor(GetColor(8));
pLoAlert.SetDefaultColor(GetColor(8));