Anyway to get a week to date chart label? So specifically, id like a label on the chart that shows the performance assuming monday start to current price. so lets say Monday open on a stock is $100, and now its wed and stock is $110. id like a label saying "WTD: 10%"
someone suggested a code like this for me, but doesnt seem to work right.
On a similar question, what about a year to date label?
someone suggested a code like this for me, but doesnt seem to work right.
Code:
#use on daily aggregation only
def newweek = getweek() != getweek()[1];
def openweek= if newweek then close else openweek[1];
def wtdchange = ((close-openweek)/openweek)*100;
addlabel(yes, "WTD %Change " + AsPercent(wtdchange));
On a similar question, what about a year to date label?