Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

    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 pkefal, 04-11-2024, 07:39 AM
                        11 responses
                        36 views
                        0 likes
                        Last Post jeronymite  
                        Started by bill2023, Yesterday, 08:51 AM
                        8 responses
                        43 views
                        0 likes
                        Last Post bill2023  
                        Started by yertle, Today, 08:38 AM
                        6 responses
                        25 views
                        0 likes
                        Last Post ryjoga
                        by ryjoga
                         
                        Started by algospoke, Yesterday, 06:40 PM
                        2 responses
                        24 views
                        0 likes
                        Last Post algospoke  
                        Started by ghoul, Today, 06:02 PM
                        3 responses
                        16 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Working...
                        X