Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entries per Direction & Unique Entries vs All Entries...

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

    Entries per Direction & Unique Entries vs All Entries...

    Hi everyone, I keep getting confused about what these two options do:

    - entries per direction
    - unique entries

    From my understanding, entries per direction specifies how many entries can be made, for example for a long position, if the strategy triggers a "long" signal. So if entries per direction is 2, I could see two open long trades open.

    The second point about unique entries I don't understand. I was thinking it may be that you can't have a long and a short position open at the same time, say if your strategy triggered long and short signals.

    Would anybody have the patience to explain this to me? Thanks a lot in advance!


    #2
    Hello Oracletrades,

    Thank you for your post.

    Entries per direction you're pretty much dead on. If you have entries per direction set to 2, you can take up to 2 entries simultaneously in the same direction before NinjaTrader will ignore further orders. So, if you have one long entry, and you take another, until you sell an entry you cannot enter again.

    Unique Positions is part of a property called Entry Handling, and that has to do with Signal Names. Basically, you can give unique names to your orders, and if you switch this to Unique Positions while your orders have unique names and your Entries Per Direction is 2, each of your uniquely named orders would be able to enter up to 2x each in a direction. So if I had 4 different uniquely named entries, I could have up to 8 entries with Unique Positions, but only 2 if I have it set to all entries.

    From our help guide:
    EntryHandling.AllEntries NinjaScript will process all order entry methods until the maximum allowable entries set by the EntriesPerDirection property is reached while in an open position
    EntryHandling.UniqueEntries NinjaScript will process order entry methods until the maximum allowable entries set by the EntriesPerDirection property per each uniquely named entry
    There's a good example on this page from our help guide that illustrates the signal names:



    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Kate is it possible to have the entries per direction set for different timeframes?

      I have a strategy that trades candlestick patterns based on the 15 30 and 60 minute charts. I would like to have only 1 entry per timeframe at any one time. So a max of 3 entries.

      Is this possible?

      Thank you,

      Nick

      Comment


        #4
        Hey Kate-

        Just wondering if you had a chance to review my question. Thank you,

        Nick

        Comment


          #5
          Hello njmeyer713,

          Thank you for your reply.

          Looks like my reply got eaten by the forum somehow.

          For something like you describe, you would want to use Unique Entries for your Entry Handling setting, with Entries Per Direction set to 1, and then you would want to give each of the three entries unique Signal Names:



          This will allow up to 1 of each uniquely named entries per direction.

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment


            #6
            Kate-

            Thank you for the reply. Let me elaborate a little, on each of the 3 different timeframes there are 4 different possible entries, each of them uniquely named. FifteenLongentry1, FifteenLongentry2, Fifteenshortentry1, Fifteenshortentry2. Same for the 30 minute and 60 minute timeframes. So 12 total unique named entries.

            As I understand it, if I set my entries per direction at 1 and set entry handling at unique entries, then I could potentially in 12 trades at one time. 4 unique entry names per each of the 3 different timeframes. Correct?

            What I want to do is only have a maximum of 1 trade per timeframe for a maximum total of 3 trades at any one time.

            Any thoughts on how to accomplish this?

            Thank you,

            Nick

            Comment


              #7
              Hello njmeyer713,

              Thank you for your note.

              What I would suggest is having a bool like OkToTradePrimary, OkToTrade15, OkToTrade30, OkToTrade60. Set these to true initially, and check whether this is true or not in the conditions for entry. If it is, submit the triggered order and set the bool to False. When the corresponding exit order is seen, set the correct bool back to true to allow another entry. With this, you could leave Entries Per Direction set to 1 and Unique entries to allow one trade per time frame at a time.

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                Thank you Kate,

                That seems to be working for me.

                My next question is this. Is there is way to tie Position.Quantity to a specific timeframe or data series?

                My exit logic is based on quantities. At the most basic level, I trade 2 contracts, scalp one and let the other go as a runner. So my code goes something like this, if quantity =2 Do this. If quantity =1 Do this.

                However, when I am trading on the three different time frames. That logic gets messed up because I could have up to 6 quantities.

                Thoughts on a solution to this?

                Does my question make sense?

                Thank you,

                Nick

                Comment


                  #9
                  Hello njmeyer713,

                  Thank you for your reply.

                  What you'd have to do in this case is to have basically a counter variable for each series and keep track of the current quantity submitted on that time frame there. You'd also need to be monitoring in OnExecutionUpdate or OnOrderUpdate for the exit orders to be filled and then decrement the counter when that occurs. So you'd keep track of each "separate position" separately without relying on NinjaTrader's internally calculated position, which would be the overall strategy position.

                  Please let us know if we may be of further assistance to you.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #10
                    Kate-

                    Thank you for the response. I was working on a solution when you posted how you would do it via the OnExecutionUpdate & OnOrderUpdate. Before I give that a try could you shed some light on the following.

                    For background. Here is my data series:

                    Code:
                     else if (State == State.Configure)
                    {
                    AddDataSeries(Data.BarsPeriodType.Minute, 30);
                    AddDataSeries(Data.BarsPeriodType.Minute, 60);
                    AddDataSeries(Data.BarsPeriodType.Minute, 240);
                    AddDataSeries(Data.BarsPeriodType.Day, 1);
                    AddDataSeries(Data.BarsPeriodType.Tick, 1);
                    
                    }
                    I'm thinking I might be misinterpreting the Positions array in the following help guide page



                    What I thought I could do is use this to check the position size for the 30 minute data series.

                    Code:
                    if (Position.MarketPosition == MarketPosition.Short
                    && (GetCurrentBid(0) + (ScalpDistance * TickSize)) > Position.AveragePrice
                    && (Positions[1].Quantity ==2))
                    
                    {
                    ThirtyDoubleStop = ExitShortStopMarket(0, true, Convert.ToInt32(Position.Quantity), Highs[1][1], @"30DoubleStop", @"30Short1-2D");
                    }
                    Would the above line of Positions[1].Quantity ==2 work or not?

                    When I run into an issue is when I have 2 contracts bought based on the 30 minute timeframe trigger and 2 bought based on the 60 minute timeframe at the same time. So total I have 4 contracts. I thought by using the above line colored red would check the quantity bought based on the 30 minute timeframe.

                    Does it make sense what I am trying to do? I looks like if it were two different instruments this would work?

                    Let me know your thoughts,

                    Thank you,

                    Nick

                    Comment


                      #11
                      Hello njmeyer713,

                      Thank you for your reply.

                      The approach you propose would only work if each added data series was of a different instrument. When it's the same instrument, the position would only be accessible from the primary data series and would represent the overall position on that instrument.

                      Please let us know if we may be of further assistance to you.
                      Kate W.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by arvidvanstaey, Today, 02:19 PM
                      2 responses
                      8 views
                      0 likes
                      Last Post arvidvanstaey  
                      Started by jordanq2, Today, 03:10 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post jordanq2  
                      Started by traderqz, Today, 12:06 AM
                      10 responses
                      18 views
                      0 likes
                      Last Post traderqz  
                      Started by algospoke, 04-17-2024, 06:40 PM
                      5 responses
                      46 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by mmckinnm, Today, 01:34 PM
                      3 responses
                      6 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Working...
                      X