• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.

    https://ninjatrader.com/support/help...d_approach.htm

    Please let me know if you have any questions.
    Last edited by NinjaTrader_JoshG; 12-12-2018, 08:44 AM.
    JoshNinjaTrader 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.
        JoshNinjaTrader Customer Service

        Comment


          #5
          Sorry for the confusion

          Comment


            #6
            Originally posted by toc17 View Post
            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?
            LiteBlue

            Can you post a code fragment? It isn't clear how you are processing the transactions.
            Last edited by Edwin420; 01-09-2019, 10:49 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by chartish, Today, 12:18 PM
            0 responses
            2 views
            0 likes
            Last Post chartish  
            Started by brokerbombero, Today, 09:42 AM
            2 responses
            22 views
            0 likes
            Last Post brokerbombero  
            Started by 12VMan, Today, 09:29 AM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by PBreen, Today, 08:41 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by U0000999, Today, 05:54 AM
            2 responses
            20 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X