Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Determining EOD in a strategy based on Day type of Base Period Type

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

    Determining EOD in a strategy based on Day type of Base Period Type

    Hello,

    I am fairly new to NinjaTrader.

    I am trying to create a Strategy to generate some alerts at the end of the day based on that day's market action.

    I have set the data series for the strategy as 'Day' Base Period Type.

    However, it is appearing like at the EOD, that day's bar does not close and therefore the code within OnBarUpdate is not executing.

    I saw some posts here and have changed my Calculate parameter from OnBarClose to OnEactTick.
    But I am not sure if that is helping.

    I am thinking of the below mechanism to overcome it.

    1. Add another data series of 1 minute inside the strategy
    2. Add a check inside OnBarUpdate method that will be executed for 1-minute bar invocations and that determines if the current time of the day is 3:59 PM
    3. If so, try to access the day's bar and make the calculations and generate the alerts.

    Is the above a feasible solution or is there a better way this could be achieved?

    Thanks.

    #2
    Hi RuthB, thanks for your question.

    A Day bar will trigger its OnBarUpdate at the beginning of the next session. Adding a minute bar and checking for 3:59 would be the best way of getting an alert at EOD. You can add the 1 minute series with AddDataSeries(). We also have a comprehensive guide on multi time frame scripts here:



    Please let me know if I can assist any further.

    Comment


      #3
      Thanks, Chris. Appreciate it!

      Comment


        #4
        For the non-intraday time periods (End of Day, Week, Month) is it possible to add some support so that we do not require adding a second intra-day series.

        Back-testing becomes a few order of magnitude slower when we have to work with intraday data; and often that data is not easy to get.

        Many platforms support market at close orders so this should be something NT could support.

        Comment


          #5
          Hi aviat72, thanks for your question.

          It's not possible unless you have the additional series or if you run the script on Calculate.OnPriceChange or Calculate.OnEachTick. I will submit a feature request to our development team to support market at close orders.

          Kind regards.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          46 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          66 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X