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:	290
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:	275
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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            88 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            134 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            119 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            67 views
            0 likes
            Last Post PaulMohn  
            Working...
            X