Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLongLimit close automatically on bar close

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

    EnterLongLimit close automatically on bar close

    I am programming an automatic strategy with this line:

    EnterLongLimit(....

    Its ok, the limit order work, but when the next bar is closing the limit order close automatically... its normal?

    Thank you

    #2
    Yes, that would be expected in managed mode marynja. The order will expire if not filled in one bar. You could set the liveUntilCancelled to true in the more advanced overload to have the order persist.

    http://www.ninjatrader.com/support/h...rlonglimit.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Now, i have other problem...

      How close the limit order?

      I am trying with ExitLongLimit(priceLongLimitActive); but dot work... the limit order stay

      Thank you

      Comment


        #4
        This command would strictly for placing an exit limit order, not for cancelling a working one. Here the CancelOrder() would be used. We have a dedicated sample on this approach here which I would suggest reviewing - http://www.ninjatrader.com/support/f...ad.php?t=18890
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Its ok. Now NT output launch thie error when i canceled a Long Limit Order and ordered other Long Limit Order in other price in the same function...

          **NT** An Enter() method to submit an entry order at '31/10/2014 17:45:00' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
          **NT** Error on calling 'OnBarUpdate' method for strategy '/74f8937615184fb6a2df09fa05923407':


          Its rare because a Short Limit Order its fill correctly if i cancel a Long Limit Order first.
          If i cancel a long limit i can order a short. If i cancel a short limit i can order a long. But i can order a long limit if i cancel a long limit previously....

          How could i cancel a limit order and lauch other similar in other price?
          Thank you.


          My functions:

          function longLimit(){
          if(LimitEntryOrder!=null)CancelOrder(LimitEntryOrd er);
          LimitEntryOrder= EnterLongLimit(0,true ,OrderQuantityVar, longLimitOrderActivePrice,"Limit Long Entry ");
          }

          function shortLimit(){
          if(LimitEntryOrder!=null)CancelOrder(LimitEntryOrd er);
          LimitEntryOrder= EnterShortLimit(0,true ,OrderQuantityVar, shortLimitOrderActivePrice,"Limit Long Entry");
          }
          Last edited by marynja; 11-18-2014, 08:39 AM.

          Comment


            #6
            marynja, I think the issue would be that you don't wait here for the Cancel to be confirmed before resubmitting the order. Plus the same signal name for both your long and short order ("Limit Long Entry ").
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Yes Bertrand. Its was a typo error when i wrote in the forum. The names are diferent in my code.
              I tried to change the signal names for each order as the next example:

              "Limit Long Entry " + CurrentBar

              but dont work...

              Some dieas? Thank you very much.

              Comment


                #8
                Thanks marynja, that's good to hear it was only a forum typo.

                In your functions you don't wait for the Cancel request to be processed. So likely you submit the new order while the old one is still in the process to get cancelled, so NT has not seen the Orderstate .Cancelled in OnOrderUpdate().
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  All right Bertrand.
                  I dont understand this function examples in NT help.
                  Please, sorry me. Could you write a simple example to get what I want?
                  Thank you very much.

                  Comment


                    #10
                    marynja, do you only work in OnBarUpdate() now for this script? Or would you also have included the more advanced OnOrderUpdate() / OnExecution() handlers? Would there be a script we could perhaps run on our end and then make a sample change for you? You could also directly send this to us via platformsupport at ninjatrader dot com.

                    Thanks,
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Ok, Thank you Bertrand. I see its more complex than i thought . Please, sorry my ignorance
                      Last edited by marynja; 11-21-2014, 03:48 AM.

                      Comment


                        #12
                        No worries at all marynja.
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Bionian, Today, 07:07 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post Bionian
                        by Bionian
                         
                        Started by averoos, Today, 05:33 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post averoos
                        by averoos
                         
                        Started by RobotSyndicate, Today, 04:27 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post RobotSyndicate  
                        Started by Ray12345, Today, 04:10 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post Ray12345  
                        Started by Behungr101, Today, 02:16 AM
                        1 response
                        10 views
                        0 likes
                        Last Post NinjaTrader_Jason  
                        Working...
                        X