Hi everyone,
I'm having an issue making this script dynamic. If I add year month date as input works perfectly but I would like to define only month and day.
I tried multiple ways including Concat but if you look at the "date1" or "date2", they are not getting concatenated, it's adding up (see labels).
I tried to change the year-month date to month and date but then AddCloud it's not working. I'll appreciate any help. Thank you.
Thinks tried:
I'm having an issue making this script dynamic. If I add year month date as input works perfectly but I would like to define only month and day.
I tried multiple ways including Concat but if you look at the "date1" or "date2", they are not getting concatenated, it's adding up (see labels).
I tried to change the year-month date to month and date but then AddCloud it's not working. I'll appreciate any help. Thank you.
Code:
input date1d = 0215;
def date1 = GetYear() + date1d;
input date2d = 0331;
def date2 = GetYear() + date2d;
def ymd = GetYYYYMMDD();
input showverticals = yes;
AddVerticalLine(showverticals and ymd == date1, "");
AddVerticalLine(showverticals and ymd == date2, "");
DefineGlobalColor("Dates", Color.LIGHT_GRAY);
AddCloud(if Between(ymd, date1, date2) then Double.POSITIVE_INFINITY else Double.NaN, Double.NEGATIVE_INFINITY, GlobalColor("Dates"), GlobalColor("Dates"));
//Printing them to see it matches
AddLabel(yes, "ymd: " + asPrice(ymd) , Color.WHITE);
AddLabel(yes, "date1: " + asPrice(date1) , Color.WHITE);
AddLabel(yes, "date2: " + asPrice(date2), Color.WHITE);
AddLabel(yes, "GetYear(): " + asPrice(GetYear()) , Color.WHITE);
Thinks tried:
Code:
#they returns expected double
def date1 = asPrice(GetYear() + date1d);
def date1 = Concat(GetYear(), date1d);