Greetings All,
On a given trading day, I am trying to extract the previous daily high of a given week and compare that with the current daily "open" price. I am trying to use that label on a 1-minute chart. The code I attempted is as follows,
On a daily time frame, the above code locates the previous daily high of a given week exactly, but when I try to use it on a 1-minute chart, it messes up. Can anyone please help me to fix the code such that I can extract the correct "previous daily high" and use the exact value on a 1minute chart label
Thank you,
Fais
On a given trading day, I am trying to extract the previous daily high of a given week and compare that with the current daily "open" price. I am trying to use that label on a 1-minute chart. The code I attempted is as follows,
Code:
# definition of previous current weekly high = PCWH
def newWeek = GetWeek() <> GetWeek()[1];
def PCWH = if NewWeek then High(period = aggregationPeriod.DAY)else if High(period = aggregationPeriod.DAY) [1] > PCWH[1] then High(period = aggregationPeriod.DAY)[1] else PCWH[1];
def PC_WH = PCWH ;
def open = Open(period = aggregationPeriod.DAY);
def p3 = Open(period = aggregationPeriod.DAY)< PC_WH;
AddLabel(yes, Concat("PCWH: ", PC_WH), Color.oraNGE);
AddLabel(yes, Concat("Open: ", Open(period = aggregationPeriod.DAY)), Color.cyan);
AddLabel(yes, "Status ", if p3 then color.green else color.red);
On a daily time frame, the above code locates the previous daily high of a given week exactly, but when I try to use it on a 1-minute chart, it messes up. Can anyone please help me to fix the code such that I can extract the correct "previous daily high" and use the exact value on a 1minute chart label
Thank you,
Fais