Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"Immediatly submit live working historical orders"

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

    "Immediatly submit live working historical orders"

    I have strategy that places an entry limit order after a setup. After 11:00 am, if the entry order is not filled, the strategy cancels the entry limit order, as follows:

    private IOrder EntryOrder;
    ...
    if (Setup) {
    EntryOrder = EnterLongLimit(0, true, MyPositionSize, MyEntryPrice, "MySigName");
    }
    ....
    if (ToTime(Time[0]) >= 110000) {
    if (EntryOrder != null) CancelOrder(EntryOrder);
    }

    Under normal circumstances, this code works as expected. However, if "Immediately submit live working historical orders" is set, then when I start the strategy after Setup is true, the entry limit gets placed immediately as it should, but the order is not cancelled, if unfilled, at 11:00am.

    I suspect NT is issuing the entry order outside of my code, hence the EntryOrder variable is not being set in this case (== null), hence, the CancelOrder method is not being called.

    Is there a way for my code to obtain the IOrder value for orders placed immediately by NT when a strategy is started with "Immediately submit live working historical orders" set? Or do you have another suggestion for what I want to accomplish?

    #2
    trader20, is the strategy showing a historically filled position if you start this up after 'setup' and with 'immediately submit' on?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I have never started the strategy when there would be an open (ie. filled entry order) position on. What I am describing is when I start the strategy when there should be no open positions but when there should be an entry limit working to get into a position. And as I said, this work as expected since "Immediately submit" is set. NJ immediately issue a limit order to enter.

      Maybe I don't understand your question. Please clarify if so.

      Comment


        #4
        trader20,

        Use TraceOrders = true and let us know what the output says when it tries to cancel.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          This idea might not relate exactly.

          Why not set time parameters for your strategy so that when you start the strategy it is with in a certain time period. 830am- 3pm

          My question is can TIME values like, 9.30am, be a private bool and a variable?

          Comment


            #6
            mainstrea, yes you could set a boolean to 'true' at a certain time - for general time filter implementation please see this sample - http://www.ninjatrader-support2.com/...ead.php?t=3226
            BertrandNinjaTrader Customer Service

            Comment


              #7
              That worked.

              How would I make the TIME into a variable setting? It seems that the Private Int can't convert to system time.

              Comment


                #8
                You would need to create a user defined input of DateTime for this.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  yes would you have a sample for that?

                  Neither

                  private bool Timein = 93000; // Default setting for Time

                  or

                  private int Timein = 93000; // Default setting for Time

                  seems to work

                  Comment


                    #10
                    In the variables section -

                    Code:
                     
                    private DateTime myTime = DateTime.Today;
                    In the properties section -

                    Code:
                     
                    [Description("I'm A Time Input")]
                    [GridCategory("Parameters")]
                    public DateTime MyTime
                    {
                    get { return myTime; }
                    }
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Thank you.

                      Comment


                        #12
                        Two additional points.

                        First, am I correct that the GREATER THAN and LESS THAN can't be applied to actual times as set in Private DateTime.Mytime?

                        Second, back to the original question of the poster, would the "First Bar of Session" qualifier begin a strategy from the moment it is started, meaning no manual matching of position?

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Rooskie, Today, 05:37 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post Rooskie
                        by Rooskie
                         
                        Started by RubenCazorla, Today, 03:23 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post RubenCazorla  
                        Started by Mr Bread, 06-01-2024, 04:14 AM
                        5 responses
                        63 views
                        0 likes
                        Last Post Mr Bread  
                        Started by Jakub, 07-19-2024, 11:06 AM
                        6 responses
                        58 views
                        0 likes
                        Last Post Jakub
                        by Jakub
                         
                        Started by FOMOzombie, 06-26-2024, 08:01 AM
                        8 responses
                        64 views
                        0 likes
                        Last Post DonnieTrader  
                        Working...
                        X