# show_date_on_signal_00
# https://usethinkscript.com/threads/is-it-possible-to-have-the-date-along-with-the-arrow-when-using-a-study.13745/
# Is it possible to have the date along with the arrow when using a study?
def na = double.nan;
def bn = barnumber();
#def lastbar = !isnan(close[0]) and isnan(close[-1]);
#-----------------------------------
#from tos chat - mobius
def data = getYYYYMMDD();
def year = Round(data/10000, 0);
def month = Round((data % 10000) / 100, 0);
def day = (data % 100);
input test_date = no;
addLabel(test_date, "date: " + month + "/" + day + "/" + AsPrice(year), color.white);
#-----------------------------------
# test signals - 2 avg crossing
def price = close;
input ma1_len = 22;
input ma1_type = AverageType.EXPONENTIAL;
def ma1 = MovingAverage(ma1_type, price, ma1_len);
input ma2_len = 44;
input ma2_type = AverageType.EXPONENTIAL;
def ma2 = MovingAverage(ma2_type, price, ma2_len);
input show_lines = yes;
plot z1 = if show_lines then ma1 else na;
z1.setdefaultcolor(getcolor(1));
z1.hidebubble();
plot z2 = if show_lines then ma2 else na;
z2.setdefaultcolor(getcolor(2));
z2.hidebubble();
#----------------------------------
def condition = ma1 crosses ma2;
#---------------------------------
input arrow_factor = 0.003;
def dwn = if condition then high*(1+arrow_factor) else Double.NaN;
input show_down_arrow = yes;
input arrow_size = 4;
plot result = dwn;
result.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
result.SetLineWeight(arrow_size);
result.AssignValueColor(Color.MAGENTA);
#---------------------------------
# show date on signal bar, in different ways
# bubble
input date_bubble1 = yes;
def vert_factor = 0.001;
#def buby = ( high * (1 + (arrow_size * vert_factor)));
def buby = ( dwn + (high *((arrow_size * vert_factor))));
addchartbubble(date_bubble1 and dwn, buby, month + "/" + day, color.yellow, yes);
input date_bubble2 = no;
addchartbubble(date_bubble2 and dwn, buby, month + "\n" + day, color.yellow, yes);
# vertical line
input vertical_line_with_date = no;
addverticalline(vertical_line_with_date and dwn, month + " / " + day, result.takevaluecolor(), curve.SHORT_DASH);
#addverticalline(vertical_line_with_date and dwn, month + " / " + day + " / " + AsPrice(year), color.yellow);
# above/below
input date_above_below_candle = yes;
plot dwn_mo = if date_above_below_candle and condition then month else Double.NaN;
dwn_mo.SetPaintingStrategy(PaintingStrategy.values_above);
dwn_mo.AssignValueColor(Color.white);
plot dwn_day = if date_above_below_candle and condition then day else Double.NaN;
dwn_day.SetPaintingStrategy(PaintingStrategy.values_below);
dwn_day.AssignValueColor(Color.white);
#