Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Starting a strategy in middle of session

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

    Starting a strategy in middle of session

    How do I start a strategy in the middle of a session/day and get it to execute without regards to what my position would be if I had started the strategy at the beginning of the day?

    I have read this post already.

    #2
    Not sure what you mean by this. Could you elaborate?
    RayNinjaTrader Customer Service

    Comment


      #3
      Market has been open for 3 hours but I do not have any open positions because I just turned my computer on after sleeping in late. I start my automated strategy hoping to take advantage of the gigantic uptrending day. After 5 minutes my strategy parameters are met and a buy should be triggered but, no order is placed because the strategy position is already long a imaginary/simulated position from earlier in the morning.
      How do I get njt to ignore or disregard that earlier simulated trigger.

      Comment


        #4
        You would need to programatically change your code in the first line of OnBarUpdate()

        if (Historical)
        return;;

        This will only then run on real-time data.
        RayNinjaTrader Customer Service

        Comment


          #5
          I'm confused as to what "Immediately submit live working historical orders" accomplishes. I've read the explanation in the help guide a bunch of times and it seems like having that option selected would address my problem. Of course, I have it selected and it ain't

          Comment


            #6
            It means as you start a strategy, it will calculate its current position and order state. If there are working orders it will convert these to live orders.
            RayNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Ray View Post
              It means as you start a strategy, it will calculate its current position and order state. If there are working orders it will convert these to live orders.
              I'm sorry but I still dont understand what that translates to a non-programmer. What exactly is a "working order"?

              Comment


                #8
                What's really throwing me for a loop is that the other option is "wait until flat before executing live" The description given in the manual seems self explanatory in that the strategy has to have no open positions before it can execute any additional orders. So... since "immediately submit live working orders" is the alternative selection, it should not wait until the strategy is flat, it should go ahead and execute any orders the strategy triggers?

                Comment


                  #9
                  dtf139: This area really drove me nuts when I first started using NT. In essence, regardless of how you have that option set, NT is not going to place any "real" orders when catching up on historical data after you start your strategy. What it will do, however, is adjust its own internal position so that it thinks it is long or short depending on the value of that option. I gave a few other comments after figuring out how to handle it in my own strategies here: http://www.ninjatrader-support.com/v...ead.php?t=4062

                  Comment


                    #10
                    When you run your strategy live -

                    - It will run a backtest on historical data
                    - On the current bar (right most bar on a chart) your strategy may be in a position and your strategy may have a stop and target to protect the position (for example)

                    "Immediately submit live" would submit (convert) these orders into live orders

                    "Wait until flat" will let the strategy play out in virtual simulation (just like a backtest) until flat before executing any live orders
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Okay! Thanks Ray, Pete. I finally got my head around it.

                      Comment


                        #12
                        Could someone post a screen shot or describe in detail how to use "historical" in conjunction with OnBarUpdate? I'm not a programmer and dont have a clue as to the correct syntax and where exactly to place it in the line of code.

                        thanks!

                        Comment


                          #13
                          Code:
                          if (Historical)
                               return;
                          You would put this at the very beginning of your OnBarUpdate() method if you wish to not process your code if the data is historical.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            when you say "beginning" do you mean directly after OnBarUpdate on the same line, or on the next line down? Before or after the other lines of code that are in my strategy?

                            Comment


                              #15
                              Right after the bracket.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Today, 05:17 AM
                              0 responses
                              46 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              126 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              66 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              42 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              46 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X