Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Chris L.NinjaTrader Customer Service

    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.
          Chris L.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by itrader46, Today, 09:04 AM
          0 responses
          3 views
          0 likes
          Last Post itrader46  
          Started by timmbbo, Today, 08:59 AM
          0 responses
          1 view
          0 likes
          Last Post timmbbo
          by timmbbo
           
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          14 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X