anyway to create a chart label for on pace for year? for instance, lets say AAPL is up 1% on jan 31. this would have Year gains to be on pace for 12%.
so the formula would be something like this...
(((close-year start price)/year start price)/days so far this year)*365
(close-year start price)/year start price) is basically a YTD performance label.
i dont know how to get "days so far this year). so for Jan 31, need that value to be 31.
this is my code below for YTD.
declare hide_on_intraday;
input price = close;
input length = 1;
input displace = 0;
input Show_Labels = yes;
def newyear = if getYear() != getYear()[1] then 1 else 0;
def yo = compoundValue(1, if newyear then open else yo[1], open);
def yearopen = yo;
def SMA = Average(price[-displace], length);
def yochange = (sma - yearopen) / yearopen ;
AddLabel(Show_Labels, concat("YTD: ", AsPercent(yochange)), CreateColor(255,162,231));
if anyone can help, i appreciate it!
so the formula would be something like this...
(((close-year start price)/year start price)/days so far this year)*365
(close-year start price)/year start price) is basically a YTD performance label.
i dont know how to get "days so far this year). so for Jan 31, need that value to be 31.
this is my code below for YTD.
declare hide_on_intraday;
input price = close;
input length = 1;
input displace = 0;
input Show_Labels = yes;
def newyear = if getYear() != getYear()[1] then 1 else 0;
def yo = compoundValue(1, if newyear then open else yo[1], open);
def yearopen = yo;
def SMA = Average(price[-displace], length);
def yochange = (sma - yearopen) / yearopen ;
AddLabel(Show_Labels, concat("YTD: ", AsPercent(yochange)), CreateColor(255,162,231));
if anyone can help, i appreciate it!