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 and EnterShortLimit simultaneously

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

    EnterLongLimit and EnterShortLimit simultaneously

    Hello,
    I am working with NT8

    I want to make a simple gap strategy, that send buy limit and short limit orders to both sides of a day gap. But only the first limit order is effective in Strategy Analyzer

    Code:
    if (Times[0][0].TimeOfDay == InicioSesion.TimeOfDay)
    {
    if (OpenHoy > CloseAyer){
    paraLong = CloseAyer - AnchoZonas;
    paraShort = OpenHoy + AnchoZonas;
    }else{
    paraLong = OpenHoy - AnchoZonas;
    paraShort = CloseAyer + AnchoZonas;
    }
    EnterLongLimit(1, paraLong, @"limitLargo");
    EnterShortLimit(1, paraShort, @"limitCorto");
    }

    I also observe that the order is only executed in the following bar, but I want both limit ordes to be GTC, and I have Time in Force = GTC in Strategy Analyzer

    What is wrong?

    #2
    Hello toc17,
    Thanks for your post.

    I would not expect for the EnterShortLimitOrder() to ever get placed as it conflicts with NinjaTraders Internal Order Handling Rules. Please see the following link for more information on these rules and the other considerations you will need to make while using the Managed Approach.



    Please let me know if you have any questions.
    Last edited by NinjaTrader_JoshG; 12-12-2018, 08:44 AM.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thank Josh! By the way, I use NT8

      I found the explanation for one of my problems, , but I can't find any explanation for not executing the second order:

      EnterLongLimit(0,true,1, paraLong, @"limitLargo");
      EnterShortLimit(0,true,1, paraShort, @"limitCorto");

      Could you please post a link to an explanation of this?

      Comment


        #4
        toc17,

        It's in the link I posted above in the Order handling rules section. I will quote the relevant section below, for your convenience.

        Methods that generate orders to enter a position will be ignored if:
        • A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
        • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
        • The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
        • The entry signal name is not unique
        If you would like information about NT8, please post in the NT8 forum. Here is the Order handling rules section of the NT8 help guide.

        https://ninjatrader.com/support/help...antedPositions
        Last edited by NinjaTrader_JoshG; 01-09-2019, 09:09 AM.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Sorry for the confusion

          Comment


            #6
            fainabuff,

            Welcome to the NinjaTrader forums!
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by nicolashmartin

              TcsWebmail
              LiteBlue
              Upsers

              It isn't clear how you are processing the transactions.
              facing similar issue

              Comment


                #8
                I would not expect for the EnterShortLimitOrder() to ever get placed as it conflicts with NinjaTraders Internal Order Handling Rules.
                Thanks! Now everything is clear cause I didn't realize this conflict may be the reason of my issue. Glad I found this info!

                Comment


                  #9
                  patriciafoster,

                  Welcome to the NinjaTrader forums!
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Yesterday, 06:40 PM
                  2 responses
                  19 views
                  0 likes
                  Last Post algospoke  
                  Started by ghoul, Today, 06:02 PM
                  3 responses
                  14 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  45 views
                  0 likes
                  Last Post jeronymite  
                  Started by Barry Milan, Yesterday, 10:35 PM
                  7 responses
                  20 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  10 responses
                  181 views
                  0 likes
                  Last Post jeronymite  
                  Working...
                  X