Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

my day strategy won't place live order, only turns yellow

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

    my day strategy won't place live order, only turns yellow

    Hi,

    I have implemented intraday strategies on NT, they are fine. Now I have a E-Mini strategy with day frequency, I can't get the following code to place a live order. It just turns yellow.

    if( ToDay(Time[0])>=20141111 ){
    entryOrder = SubmitOrder(
    0, OrderAction.Buy, OrderType.Market, origSize, 0, 0, "", sigName);
    Println(
    "day and time: " + Time[0] );
    }

    In Initialize(), I have
    CalculateOnBarClose=true;
    Unmanaged=true;

    In NT options, I have "wait until flat before executing live".

    Thank you

    #2
    Follow up thought: from my understanding of OnBarUpdate(), with
    CalculateOnBarClose=true, this morning Nov 12 should have the Nov 11 bar closed, then that submitOrder() should be placed to live.

    But since the strategy is yellow, it seems that NT treats that Nov 11 submitOrder() as having already happened. But it couldn't since the Nov 11 day bar does not complete until this morning. Right?


    Also I tried same code last night Nov 11 night, it wouldn't place since the Time[0] is still Nov 10. Now it is Nov 12 morning, and Time[0] is Nov 11, but it won't place live order because it thinks the order submit has already been done.

    My approach and understanding may be wrong. The questions is How can I place a live order for day-frequency strategy?

    Last edited by Tony345; 11-12-2014, 07:46 AM.

    Comment


      #3
      Hello,
      Thank you for your post.
      Yellow highlighted "Strategy" cell indicates the strategy is waiting to be flat before submitting any live orders. The strategy has virtual historical orders that must be flat before it will place an order. A work around for this is to go to Tools -> Options -> Strategies -> NinjaScript and change the setting for "On starting a real-time strategy" to "immediately submit live working historical orders. I would like to note that it is important to understand that the position of the strategy in the strategies tab may not reflect the accounts actual position that is reported in the Accounts tab. Please see the following link on these settings. http://www.ninjatrader.com/support/h...tegies_tab.htm
      The November 11 day bar will close at the end of the day and may be a different time depending on different providers.
      The Nov 11 SubmitOrder() will not be placed until the Nov 12th has opened/created a new bar.
      If you want to see where these orders were placed go to strategy performance. To the Strategies tab in the control center and right-clicking on the strategy and select "Strategy Performance." Please see the following link on How to view Strategy performance. http://www.ninjatrader.com/support/h...egies_tab2.htm
      If I can be of any other assistance please let me know.
      Cody B.NinjaTrader Customer Service

      Comment


        #4
        Hi Cody,

        Thank you for the reply. I understand the use of "immediately submit live working historical orders", but do not want to use it because I have other strategies running, this Option change would be applied to all the strategies.

        Talking about the yellow status, meaning the strategy has virtual historical order. But it does not have other orders, only thing it does is place one order when last bar's day is 20141111, but NT treats it as if already historical, which does not make sense.

        protectedoverridevoid OnBarUpdate()
        {
        if( ToDay(Time[0])>=20141111 ){
        entryOrder = SubmitOrder(
        0, OrderAction.Buy, OrderType.Market, origSize, 0, 0, "", "testSig");
        Println(
        "day and time: " + Time[0] );
        }
        }

        Last edited by Tony345; 11-12-2014, 08:31 AM.

        Comment


          #5
          Hello,
          This is a virtual historical order thus a virtual historical position was created. This is treated as historical because virtually it is placed before the current time.
          You can view the last historical order placed with the Strategy Performance.
          If you do not want to historical items to show up you will need to use if(Historical) return;
          in the beginning of the OnBarUpdate(). This will then ignore all historical data.
          If I can be of any other assistance please let me know.
          Cody B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          21 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          10 views
          0 likes
          Last Post cre8able  
          Working...
          X