Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What causes a null return from EnterShort and EnterLong"

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

    #31
    EnterShort/EnterLong problems....

    Guys,

    What debug do you want me to put into place so that we can determine what is happening? To help me get what you need, the more specific you can be the better.

    I'm definitely getting back a null reference from EnterShort() today - I'd like to figure out what is causing it!

    John

    Comment


      #32
      John,

      TraceOrders = true in Initialize().
      and Prints in OnOrderUpdate() to track those orders.
      Code:
      Print(order.ToString());
      Find the outputs of when you actually submit the order you feel is having issue and paste in the complete transcription of the output afterwards.
      Josh P.NinjaTrader Customer Service

      Comment


        #33
        Debug Info....

        Originally posted by NinjaTrader_Josh View Post
        John,

        TraceOrders = true in Initialize().
        and Prints in OnOrderUpdate() to track those orders.
        Code:
        Print(order.ToString());
        Find the outputs of when you actually submit the order you feel is having issue and paste in the complete transcription of the output afterwards.

        Will do - I will post as soon as I see the behavior - but it may take a day or two!

        John

        Comment


          #34
          To expedite the process you could try using the Sim Feed and running on something like a 3 second chart. You can control the price to move up and down to fill your orders and such.
          Josh P.NinjaTrader Customer Service

          Comment


            #35
            Got some data!

            I finally gave up waiting for the occurrence to happen naturally and forced entries into the market based on a very simple rule. I observed the following behavior:

            1st and 2nd entries ok, 3rd (and presumably 4th) entry did not happen.

            In the strategy parameters i have:
            Entries per direction 4
            Entry handling AllEntries

            I get the following output:
            8/7/2009 9:31:16 AM Entered internal PlaceOrder() method at 8/7/2009 9:31:16 AM: Action=SellShort OrderType=Market Quantity=147 LimitPrice=0 StopPrice=0 SignalName='[4342] Force Short Entry' FromEntrySignal=''
            8/7/2009 9:31:16 AM Ignored PlaceOrder() method at 8/7/2009 9:31:16 AM: Action=SellShort OrderType=Market Quantity=147 LimitPrice=0 StopPrice=0 SignalName='[4342] Force Short Entry' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

            So, can you tell me why this is getting denied? It must be something with the EntryHandling property because EntriesPerDirection should be 4.....

            I checked my code and I'm not explicitly setting EntriesPerDirection, but I am setting EntryHandling = EntryHandling.AllEntries; in Initialize().

            John

            Comment


              #36
              jlbishop,

              It is being denied because you already have 4 positions open and it will NOT open any further orders.
              Josh P.NinjaTrader Customer Service

              Comment


                #37
                What is the definition of a position then?

                Originally posted by NinjaTrader_Josh View Post
                jlbishop,

                It is being denied because you already have 4 positions open and it will NOT open any further orders.
                That is interesting....at the time I this occurred I had 2 positions....unless NT has a "unique" definitiion of position.

                I had 1 trade to enter short 49 shares at 100.58, with associated profit target of buy to cover at 100.12, and another entry of 98 shares at 100.68 with an associated target of 100.22.

                Does NT treat these as 4 positions even though I really only have 2 entries and 2 profit target exits (managed through SetProfitTarget)?


                John

                Comment


                  #38
                  Pardon the terminology.

                  4 entry orders/positions are already active. If you have working entry orders those are in the count for EntriesPerDirection. If you have a filled entry and thus an open position, that counts as well.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #39
                    Originally posted by NinjaTrader_Josh View Post
                    Pardon the terminology.

                    4 entry orders/positions are already active. If you have working entry orders those are in the count for EntriesPerDirection. If you have a filled entry and thus an open position, that counts as well.
                    Ok, then I need some help to determine what is going on....At the time this was denied, I should have only had 2 filled orders with associated profit target exits. The order that was denied would have been entry #3. No other orders were active at the time.

                    ???

                    John

                    Comment


                      #40
                      John,

                      You need to just follow the complete TraceOrders log to count your entry orders. Please provide complete logs.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #41
                        Logs are on the way!

                        Originally posted by NinjaTrader_Josh View Post
                        John,

                        You need to just follow the complete TraceOrders log to count your entry orders. Please provide complete logs.
                        Josh,

                        I just sent a support e-mail with my logs - I took a look and I couldn't find anything amiss - it seems like it should work.

                        John

                        Comment


                          #42
                          John,

                          I am looking for TraceOrders logs, not the actual log files. Find the spot where you get the first Ignored order and then copy paste everything to happen before then.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #43
                            Here are the logs...

                            Logs have been sent via e-mail - they are too many characters for the message board....

                            John

                            Comment


                              #44
                              Will continue correspondence via email.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #45
                                10+ Years later .. I believe this is relevant https://ninjatrader.com/support/help...and_onexec.htm

                                I was similarly perplexed as to why EnterLong(); and EnterShort(); would return null but the example code (link below) on the above page explains everything clearly.

                                SampleOnOrderUpdate_NT8.zip

                                best
                                Drew

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by bortz, 11-06-2023, 08:04 AM
                                47 responses
                                1,608 views
                                0 likes
                                Last Post aligator  
                                Started by jaybedreamin, Today, 05:56 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post jaybedreamin  
                                Started by DJ888, 04-16-2024, 06:09 PM
                                6 responses
                                19 views
                                0 likes
                                Last Post DJ888
                                by DJ888
                                 
                                Started by Jon17, Today, 04:33 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post Jon17
                                by Jon17
                                 
                                Started by Javierw.ok, Today, 04:12 PM
                                0 responses
                                16 views
                                0 likes
                                Last Post Javierw.ok  
                                Working...
                                X