Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Inside bar order system

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

    #31
    Yes, that sounds like an accurate description. With no exits there will not be a flat state in order to submit your entry orders. You'll need exit orders if you want to see any type of historical performance.

    If you want to evaluate your entry orders in a real time scenario, you can write:

    if (Historical)
    return;

    Place that in the first lines of OnBarUpdate() method and there won't be an historical strategy position when you start the strategy. It can then immediately evaluate your entry orders.

    You can add the name of the instrument to your print statements.
    Documentation for Instrument class here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #32
      Please disregard, figured it out. Had brackets in wrong place.

      Originally posted by Marshmellowhead View Post
      I'm now getting inside bars detected at the close of every bar. I think my ";" and/or "{}" may be in error. Can you check the following code and tell me if you think I've placed them correctly?

      protected override void OnBarUpdate()
      {
      // Condition set 1
      if (High[0] <= High[1]
      && Low[0] >= Low[1])
      Print("inside bar detected");
      {
      SubmitOrder(0,OrderAction.Buy, OrderType.StopLimit, 1, High[0] + 1 * TickSize, High[0] + 1 * TickSize, "", "IB long");
      SubmitOrder(0,OrderAction.SellShort, OrderType.StopLimit, 1, Low[0] + -1 * TickSize, Low[0] + -1 * TickSize, "", "IB short");

      Comment


        #33
        I'm applying the strategy to multiple symbols. If a stop limit order is generated and appears on each chart for 2 different symbols, then one of the orders gets filled for one symbol, the stop order on the other symbol gets cancelled. How can the conditions for one symbol be blocked from interfering with another symbol?

        Comment


          #34
          Also, if the strategy generates a stop limit order that doesn't get filled, and the conditions are no longer true which generated the order, how do I get the strategy to cancel the open limit order?

          Comment


            #35
            Hello,

            Thanks for your note.

            By default there are no ties to each symbol. You just want to make sure not to share the same OCO ID which is a SubmitOrder() parameter.

            Let me know if I can be of further assistance.

            Comment


              #36
              If I've coded the strategy to check if my current position is flat before entering the buy stop order, will the strategy check my realtime position, or the supposed position according to the strategy? Right now, it doesn't appear to be checking my realtime position.

              Comment


                #37
                It will check your strategy position. Everything the strategy knows is in relation to the strategy and not your account.
                Josh P.NinjaTrader Customer Service

                Comment


                  #38
                  Originally posted by NinjaTrader_Josh View Post
                  It will check your strategy position. Everything the strategy knows is in relation to the strategy and not your account.
                  Ok, then if I'm using unmanaged orders and " if(Historical) return" so it doesn't wait to be insync with itself, how do I make the strategy factor in the realtime position and not the theoretical position? Basically, I want to automate my entries and manually enter my exits, but if the strategy want to create and entry order, and I'm already in a position I haven't manually exited, I want the strategy to do nothing.

                  Comment


                    #39
                    Hello,

                    In this case the only option availiable to you is the option under Control Center->Tools->Options->Strategies Tab->NinjaScript tab then set Wait Until flat before executing live.

                    Let me know if I can be of further assistance.

                    Comment


                      #40
                      (Position.MarketPosition == MarketPosition.Flat)
                      For this coding, "marketposition" on either side of the == sign is looking at what, the actual real time position, or the position I should be in determined by the other coding in the strategy?

                      Comment


                        #41
                        Correct, this would look only at the strategy position, you need to ensure your real account position is in sync to this -

                        BertrandNinjaTrader Customer Service

                        Comment


                          #42
                          OK, so "MarketPosition" is looking at the strategy position. Is there a different command to look at the Real time position (independent of the strategy position) ? Or some other way for the strategy to lookup the real time position?

                          Comment


                            #43
                            Unfortunately this is not possible programmatically - you would ensure both are in sync -



                            In out NT7 we added an option to AutoSync both if needed with a Market Orders issued by NinjaTrader (SyncAccountPosition property).
                            BertrandNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by geddyisodin, Today, 05:20 AM
                            3 responses
                            20 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Started by lorem, Today, 09:18 AM
                            1 response
                            5 views
                            0 likes
                            Last Post lorem
                            by lorem
                             
                            Started by bmartz, Today, 09:30 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post bmartz
                            by bmartz
                             
                            Started by GussJ, 03-04-2020, 03:11 PM
                            14 responses
                            3,245 views
                            0 likes
                            Last Post GussJ
                            by GussJ
                             
                            Started by ArkansasClint, Today, 09:28 AM
                            0 responses
                            2 views
                            0 likes
                            Last Post ArkansasClint  
                            Working...
                            X