Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

open position if time

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

    open position if time

    Hi,

    Is there a way to enter a position only if time is between 6am and 8am?
    And exit in 45 mins of entry?

    Thanks,
    JR

    #2
    Sure John, you could limit trading hours via a so called TimeFilter, as shown in more detail in the following sample - http://www.ninjatrader.com/support/f...ead.php?t=3226

    You could check for a specific time to exit or calculate 45 mins from your entry, but as first step working with BarsSinceEntry might be easier - http://www.ninjatrader.com/support/h...BarsSinceEntry

    Comment


      #3
      Thx for the link. Looks like I need something like this
      // Only trade between 7:45 AM and 1:45 PM
      if (ToTime(Time[0]) >= 74500 && ToTime(Time[0]) <= 134500)
      {
      // Strategy logic goes here
      }

      Comment


        #4
        Correct, looks good John.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        20 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        120 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        174 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        92 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        134 views
        0 likes
        Last Post cmoran13  
        Working...
        X