Skip to content

Instantly share code, notes, and snippets.

@dimfeld
Created November 21, 2019 18:50
Show Gist options
  • Save dimfeld/c0c9d6c067a73ff4c14c29f17d125e3b to your computer and use it in GitHub Desktop.
Save dimfeld/c0c9d6c067a73ff4c14c29f17d125e3b to your computer and use it in GitHub Desktop.
Thinkscript for Days until Earnings
input length = 60;
def xx = -GetEventOffset(Events.EARNINGS);
def yy = Sum(HasEarnings(type = EarningTime.AFTER_MARKET), length)[-length + 1] > 0;
plot x = xx + yy * .5;
x.AssignValueColor( if x <= 1 then Color.LIGHT_RED else Color.DARK_GRAY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment