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

not understanding Order Handling: Entries per direction

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

    not understanding Order Handling: Entries per direction

    I use the Order Handling option in my managed code called Entries per direction (5) on All Entries with exit on Session closed checked

    I use the EnterLong and EnterShort methods for entry.

    It works as imagined.. enters up to 5 entries and ignores any further calls to EnterLong/Short

    But I have noticed this twice now (and I'm not sure, maybe it happens every time - because it takes a while to notice and this Strategy is new and "beta" still)

    What happens is that it gets up to 5 entries... i.e. contract size x 5 volume displayed in the chart trader.

    And everything is fine for a while.. let's say an hour.

    then I notice it started entering new postiions again


    My code I'm sure from the start called EnterLong/Short umpteen times.. but I'm not sure why NT8 is paying attention to them again after ignoring them for a long while.

    Can you think of any possible explanations?

    I don't think it is the Session closed exit because I'm pretty sure the end of session hasn't occurred yet.


    #2
    Hello NinjaCustomer,

    Thanks for your post.

    The entries per direction would limit the entries in the same direction at any one time. As orders are closed then the entries per direction would be reduced and this would allow additional entries, up to 5 in this case in the same direction at the same time.

    Can you clarify if you are seeing more than 5 entries in the same direction at the same time?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      what does "at the same time" mean? to clarify, nothing was sold in the opposite direction or closed since the start of the strategy.

      note: this is running on forex in demo mode with 10,000 units so initially it got up to 50,000 units sold.. then stayed that way for an hour or so.. then started again and got up to 80,000 and then 100,000 now (twice the entries per direction limit)

      Just to be clear, there were (most likely) many calls in the space of an hour that were ignored.. I have this strategy running on a really small time frame so as to "work out the kinks" quickly. So enter and exit method calls occur often multiple times within a minute.

      Comment


        #4
        Hello NinjaCustomer,

        Thanks for your reply.

        At the same time means just that, at the same time you can only have 5 separate entries in the same direction. You can have multiple entries and exits in the same session but at any one time, it should only be 5 in the same direction.

        Please post your strategy and the steps to recreate the condition you are asking about so I may test on our end. The steps to recreate need to be all of the strategy settings you used and on what instrument and time frames for the purposes of recreating your results and observations.

        If you do not wish to post on the forum, please feel free to send into PlatformSupport[at]NinjaTrader[dot]Com, mark the e-mail Atten: Paul, include a link to this thread and attach your strategy source code to the e-mail.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hi Paul,

          for now I can easily add my own constraints to prevent this from happening - I just wanted to check that I understood correctly how it is supposed to work. If I email it in the future, I'll include a link to this thread. thanks

          Comment


            #6
            Did your short exit those longs?

            are you saying you are up to 7,8,9 separate entry long positions?

            Comment


              #7
              no currently my code does not exit unless a take profit or stop loss is used but that was turned off. (I think, I'm pretty sure - however I don't know how to check right now because the strategy is running and I don't want to interrupt it)... other than that it currently relies upon a manual close or disabling of the strategy to flatten the position.I want to eventually add some buttons. It is a manual trading enhancing strategy, not a fully-automatic one.

              I'm writing more print statements into my code to try to catch what is going on next time.

              This pattern is just strange... 5 EntriesPerDirection allowed, I don't open anything in an opposite direction ever, it fills up the first 5 entries fine after some minutes depending upon the market .. then runs maybe half an hour or hour and then starts to fill up again another 5... then another hour or so and no more positions are added. I re-read my code and couldn't find anything blatantly obvious.

              All entries are in the same direction (the direction specified by my Buy flag user-defined UI property.. if true Long, if false Short

              Comment


                #8
                Hello NinjaCustomer,

                Thanks for your reply.

                You can observe the number of active positions per strategy in the strategies tab.

                If you have profit targets employed those will also close positions.

                Debugging with print statements will be the best approach.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Paul.
                  My strategy has 1 entry per direction. (the strategy is defined on bar close)
                  If I change 2 entries per direction. Send 1 long position and the following bar send 1 long position.
                  The exit position is in the same bar for both long positions.
                  How I can send 2 long positions in the same bar?
                  thanks

                  Comment


                    #10
                    Hello memonic,

                    Thanks for your post.

                    You can send two entries like this example:

                    if (your condition to enter)
                    {
                    EnterLong();
                    EnterLong();
                    }
                    Paul H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DJ888, 04-16-2024, 06:09 PM
                    4 responses
                    12 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by terofs, Today, 04:18 PM
                    0 responses
                    11 views
                    0 likes
                    Last Post terofs
                    by terofs
                     
                    Started by nandhumca, Today, 03:41 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post nandhumca  
                    Started by The_Sec, Today, 03:37 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post The_Sec
                    by The_Sec
                     
                    Started by GwFutures1988, Today, 02:48 PM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Working...
                    X