• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:

    https://ninjatrader.com/support/help...nstruments.htm

    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 WHICKED, Today, 01:01 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by polo0202, Today, 12:15 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_BrendanC  
          Started by GARZONJ, Today, 11:27 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by NtFan, Today, 11:08 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by anamaria0589, Today, 09:39 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Jermaine  
          Working...
          X