Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to?: Exit and Avoid Executions x Days around the Earnings Reports

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

    How to?: Exit and Avoid Executions x Days around the Earnings Reports

    Hi Forum,

    Is there any code that can remove trade executions from dates around the earnings period?


    I have a strategy that I do not ever want it to be executed +/- 10 business days from any earning's period.

    Furthermore, is there any way to enhance this, so that if i am Long/Short in a position, when said open position reaches +/- 10 days from earnings it simply closes, irrelevant of everything else in the strategy.

    Thanks in advance.
    G

    #2
    Hello gaz0001,

    Thanks for your post.

    You can do a date comparison to determine the number of days away from the event and use that to set a bool variable that can then be used to prevent any entries or exits as you wish. Certainly, the logic can be set up to close any open positions as you wish.

    Here is a link to an educational example of working with date time functions: https://ninjatrader.com/support/help...me_objects.htm

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello gaz0001,

      Thanks for your post.

      You can do a date comparison to determine the number of days away from the event and use that to set a bool variable that can then be used to prevent any entries or exits as you wish. Certainly, the logic can be set up to close any open positions as you wish.

      Here is a link to an educational example of working with date time functions: https://ninjatrader.com/support/help...me_objects.htm
      Thanks for the reply Paul.

      ​​​​​​I'm very new to using C# and NT8.

      I guess there would be no limitation in NT8 to use something like a Yahoo httprequest string to automatically pull the earnings date for this and the other tickers in my strategy, then use the logic you provided the link to already to work around the earnings dates.

      Comment


        #4
        Hello gaz0001,

        Thanks for your reply.

        Yes, that would be possible, assuming the information can be pulled that way.

        Another alternative would be to manually create a file that has all of the instruments and dates of interest and you can use C# streamReader for that to then pull the dates into the script.

        If you would like something created for you we could provide a link to 3rd party programmers in the NinjaTrader Ecosystem that can provide the service.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        56 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        34 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        195 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        359 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        281 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X