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 argusthome, 03-08-2026, 10:06 AM
        0 responses
        85 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        47 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        29 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        67 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X