NexusFi: Find Your Edge


Home Menu

 





Earnings Label


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,067 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

Earnings Label

  #1 (permalink)
skynetgen
Randolph
 
Posts: 4 since Jul 2018
Thanks Given: 8
Thanks Received: 0

Displays a label on daily chart. If stock has earnings coming in next 5 days or had it 2 days ago
 
Code
declare once_per_bar;

def pastoffset =GetEventOffset(Events.EARNINGS,-1);
def futureoffset =GetEventOffset(Events.EARNINGS);

def earningsAnnounced=HasEarnings(EarningTime.ANY);
def isBefore = HasEarnings(EarningTime.BEFORE_MARKET);
def isAfter = HasEarnings(EarningTime.AFTER_MARKET);
def isDuringOrUnspecified = HasEarnings() and !isBefore and !isAfter;

def nearEarnings=pastoffset <=2 or (futureoffset>=-5 and HasEarnings()) or futureoffset==-1 ;
def offset = if pastoffset < absvalue(futureoffset) or !earningsAnnounced  
             then pastoffset else futureoffset;

AddLabel(   nearEarnings,"Earnings " 
    +(if offset <0 then  "in " +(-offset)
   else if  offset>0 then offset + " ago"
   else  if !earningsAnnounced then "no announce" 
   else "Today ")
   + (if isbefore then "PreMkt" else if isafter then "AftHrs" else "") 
    ,
    if offset < 0 then  Color.MAGENTA else color.LIGHT_ORANGE);
#debug
#AddLabel( yes," EarnDebug " +"Anounce "+ earningsAnnounced +"\ " + pastoffset+"|"+futureoffset + (if isbefore then "PM" else if isafter then "AH" else "") , color.blue);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
Quantum physics & Trading dynamics
The Elite Circle
What broker to use for trading palladium futures
Commodities
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #2 (permalink)
 castone1 
Greenville, South Carolina
 
Experience: Advanced
Platform: NinjaTrader
Trading: Stocks
Posts: 2 since Apr 2015
Thanks Given: 0
Thanks Received: 1

Do you know if anyone has an earnings label indicator for NinjaTrader 8 charts?

Reply With Quote




Last Updated on July 14, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts