RobnATL
New member
I am trying to calculate the percentage change in Close since the last Earnings Date, but I am having difficulty with retrieving 'Close' from the last earnings date by using EarningsOffset. Is this possible to calculate and use in a column, label, or study?
This is the script I have built so far. Any help would be greatly appreciated.
def earningsOffset = GetEventOffset(eventType = Events.EARNINGS, numberOfEventsToSkip = -1);
def earningsDate = GetValue(GetYYYYMMDD(), earningsOffset);
def oldclose = if barnumber() == 1 then double.nan else if earningsDate then close else oldclose[1];
def diff = Round(((close - oldClose) / oldclose) * 100, 1);
plot percentChange = diff;
This is the script I have built so far. Any help would be greatly appreciated.
def earningsOffset = GetEventOffset(eventType = Events.EARNINGS, numberOfEventsToSkip = -1);
def earningsDate = GetValue(GetYYYYMMDD(), earningsOffset);
def oldclose = if barnumber() == 1 then double.nan else if earningsDate then close else oldclose[1];
def diff = Round(((close - oldClose) / oldclose) * 100, 1);
plot percentChange = diff;