Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy to only run during specific hours

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

    Strategy to only run during specific hours

    Hello.
    I am using Strategy Builder to create my strategy.
    I want to have my strategy omit certain times of the day, specifically between 7:39am and 1:00pm.
    I found these instructions I am following: https://ninjatrader.com/support/help...to_limit_t.htm
    So I input this into the Strategy Builder. When I do a backtest using Strategy Analyzer, it is still showing trades being taken after 1:00pm.
    Did I do something wrong? How to fix this?

    Click image for larger version

Name:	image.png
Views:	276
Size:	8.5 KB
ID:	1296881

    #2
    Here is example to show the trade showing up after 1:00pm:
    Click image for larger version

Name:	image.png
Views:	263
Size:	11.9 KB
ID:	1296884

    Comment


      #3
      Hello betsuni_123,

      Do you have multiple condition sets that submit orders?

      Are these time conditions in all condition sets that submit orders?

      What is the bar type an interval?

      When using Calculate.OnBarClose, orders are submitted after the bar closes and will appear filled with the open of the next bar.
      What is the next bar after 1:00 PM?
      If you change the condition to less than 12:00 PM, does this correct the behavior? (An order submitted after the 12:00 PM bar closes would fill as the 1:00 PM on a 60 Minute chart opens)
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hi Chelsea,
        I deleted this message because everything works now suddenly. I closed NT and reopened it, tried the Strategy Analyzer again and it now does not show trades past 1pm with my script. Thank you for your time either way.
        Last edited by betsuni_123; 03-22-2024, 05:33 PM.

        Comment


          #5
          Hello, I have imported the SampleTimeFilter_NT8, but how can I use it in my strategy? I can't find anything under "Conditions and Actions," not under the name "SampleTimeFilter" or "Times" as shown in the example.

          Comment


            #6
            Hello NViaene,

            Welcome to the NinjaTrader forums!

            The SampleTimeFilter from the help guide is an unlocked strategy that can be opened to view the code in the NinjaScript Editor (Control Center > New > NinjaScript Editor). On the right open the Strategies folder then double click SampleTimeFilter.

            I can also provide examples of time condition strategies that open in the strategy builder linked below. Once imported, these can be selected from the Strategy drop-down on the Welcome page of the Strategy Builder.




            Note, these are example strategies that are meant to be educational so that you can design your custom script in a similar fashion. These are not indicators or methods that can be called from another strategy.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            55 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