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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        56 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        132 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X