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 martin70, 03-24-2023, 04:58 AM
                        14 responses
                        105 views
                        0 likes
                        Last Post martin70  
                        Started by TraderBCL, Today, 04:38 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post TraderBCL  
                        Started by Radano, 06-10-2021, 01:40 AM
                        19 responses
                        606 views
                        0 likes
                        Last Post Radano
                        by Radano
                         
                        Started by KenneGaray, Today, 03:48 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post KenneGaray  
                        Started by thanajo, 05-04-2021, 02:11 AM
                        4 responses
                        470 views
                        0 likes
                        Last Post tradingnasdaqprueba  
                        Working...
                        X