Ex-dividend Days Label for ThinkorSwim

markos

markos

Well-known member
VIP
Code:
# WatchList of Label Days Till X Dividend
# If over 30 days away shows 30
# Mobius
input DaysTillXdiv = 30;

def LastDividendBar = AbsValue(GetEventOffset(Events.DIVIDEND, 0));
def NextDividend = if isNaN(LastDividendBar) then 0 else LastDividendBar;
AddLabel(NextDividend == DaysTillXdiv, "Dividend More than 30 days out", color.white);
AddLabel(NextDividend <= DaysTillXdiv-1 and NextDividend > 0, "Dividend in " + NextDividend + " days", Color.Red);
 
Last edited by a moderator:
J007RMC

J007RMC

Active member
2019 Donor
VIP
For some reason my ex div watchlist not loading?
 
T

tomsk

Well-known member
VIP
@J007RMC Make sure you have sufficient bars defined in your expansion area. If you do not do this, you won't see the data.

Go to Settings > Time Axis > Expansion area
 

Similar threads

Top