Greetings all,
I need help building a script that allows you to check if the current daily high of a given week has passed the previous daily high of the same week. It will display a label box with the following information: if broken, "New high achieved", otherwise, "No New high achieved". I wish to run it on a daily aggregation period. I have tried to write a script as follows :
"
def newWeek = GetWeek()== GetWeek()[1];
def newday = GetDay()<>GetDay()[1];
def CDH = if !newWeek then Double.NaN
else if newday then high else if high > CDH[1] then high else CDH[1];
AddLabel(yes, Concat("DH: ", CDH), Color.green);
AddLabel(yes, if CDH>CDH[1] then “New high achieved” else “No New high achieved”, if CDH>CDH[1] then color.greeN else color.red); "
The script only compares with the previous day, not with the earlier days of the same week.
Any help is much appreciated.
Thanks,
Fais
I need help building a script that allows you to check if the current daily high of a given week has passed the previous daily high of the same week. It will display a label box with the following information: if broken, "New high achieved", otherwise, "No New high achieved". I wish to run it on a daily aggregation period. I have tried to write a script as follows :
"
def newWeek = GetWeek()== GetWeek()[1];
def newday = GetDay()<>GetDay()[1];
def CDH = if !newWeek then Double.NaN
else if newday then high else if high > CDH[1] then high else CDH[1];
AddLabel(yes, Concat("DH: ", CDH), Color.green);
AddLabel(yes, if CDH>CDH[1] then “New high achieved” else “No New high achieved”, if CDH>CDH[1] then color.greeN else color.red); "
The script only compares with the previous day, not with the earlier days of the same week.
Any help is much appreciated.
Thanks,
Fais
Last edited: