Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unrecognized Orders

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

    Unrecognized Orders

    At one minute before the close of every hour, I want to close all orders in process and all pending orders. NinjaScript does not seem flexible enough to handle this, so I created a strategy (attached) with CalculateOnBarClose False that calls (in Sets 3 through 10) to ExitLong and ExitShort at one minute before the end of each hour beginning with 1:59 AM and ending with 8:59 AM. The ExitLong and ExitShort are not being executed. Why? Also, how do I close all pending hours at one minute before the end of each hour?
    Attached Files

    #2
    On which chart interval do you run this? Are you sure you get a corresponding timestamp to trigger your exits?

    Unfortunately there's no 'flatten all' from NinjaScript, so I would suggest to work with the IOrder objects -

    Comment


      #3
      Running on 60 minute chart. What do you mean by "a corresponding timestamp to trigger your exits?" I set up the strategy such that at 1:59 AM, for example, an ExitLong and ExitShort are entered. Doesn't that mean the strategy recognizes the computer's clock for that value?

      Comment


        #4
        60 minutes won't give you the needed granularity in timestamps, try for example a minute chart with your strategy.

        Comment


          #5
          Can an ExitLong and ExitShort be entered at the same time or only one per bar? What I am doing is saying that if Close of the current bar is > Open of the current bar, then enter ExitLong and ExitShort at a certain level.

          Comment


            #6
            Not sure what you mean. If you want to enter a position use EnterLong/Short(). You need to choose which position you want and place the appropriate order.

            ExitLong/Short() only work if you already have a long/short position. You can only be long or short. You cannot be both for the same instrument so not sure what behavior you are looking for with submitting both. Please clarify. Thank you.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Sorry, I misstated. I meant can I enter an EnterLong and EnterShort on the same bar? I know this can be done using two SuperDoms, but can it be written as NinjaScript? As an example, if the current bar closes at 1.012, I want to say EnterLong at 1.025 and EnterShort at 1.000 so that if the price thereafter moves up to 1.025, the EnterLong is executed but if it, instead, moves down to 1.000, the EnterShort is executed.

              Comment


                #8
                Those would be limit/stop orders not market orders. You cannot place simultaneous working orders in opposite directions for the same instrument.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, Yesterday, 10:06 AM
                0 responses
                22 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                19 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                14 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                10 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                41 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X