Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close position before earnings reports

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Close position before earnings reports

    Hi,

    I'm new in this forum so I hope I won't ask something too basic or that was already answered in the past.
    I want to backtest a system that has multiple exits. One exit is activated market on close on the day before the earnings report to avoid gaps against the trend. Does anyone know how to code it and what source of information can be used to it?

    Thanks,

    ACP

    #2
    Hello ACP,
    Welcome to the forum and I am happy to assist you.

    You can limit the timing of your trades using a time filter. Please refer to this sample code which demonstrates it


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hello Joydeep,

      Thanks for your quick answer. I'm not looking for a predefined time exit but for an exit that depends on the day of the earnings report (ER) date. Trying to clarify my idea: If I buy ABC stock and while on the trade the company will present their ER I want the position to be closed on the previous day. I want to include this exit on a code for backtest. At the moment, manually I see this information on yahoo http://biz.yahoo.com/research/earncal/20110112.html but I suppose I can't get this data on NT.
      Hope you can help me.

      ACP

      Comment


        #4
        Hello ACP,
        The sample code is just a reference point/code and not the actual code.

        You have to hardcode the date(s) and further custom code it.

        in variable
        Code:
        DateTime agmDate = new DateTime(2012, 5, 30, 15, 30, 0);
        in OnBarUpdate
        Code:
        if (Time[0] > agmDate)
        {
            //exit postions
        }

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        656 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        371 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X