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

ExitShort / ExitLong Not Exiting

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

    ExitShort / ExitLong Not Exiting

    I have my script entering with X quantity - if something happens, it exits X quantity, no problem.

    If something else happens, it only exits x/2 quantity. OK, still no problem.

    Then, when this same x/2 trigger happens again, it will not exit the other x/2 quantity and leave me flat. My output screen shows that the command was called, but NT does nothing. I tried calling an additional command ExitShort/Long() with no quantity mentioned - thinking I may have a problem with my variable, but it still doesn't execute. Something is blocking this order from being received by NT. Any thoughts?

    If I let it continue to run, many bars later it will exit and re-enter at the same time. Weird.

    #2
    Please debug your strategy as per here to see what's going on: http://www.ninjatrader-support.com/v...ead.php?t=3627

    Comment


      #3
      Thanks for the help -

      Here's my log:

      Last Bar was Green
      7/17/2008 12:47:00 PM Entered internal PlaceOrder() method at 7/17/2008 12:47:00 PM: Action=BuyToCover OrderType=Market Quantity=0.1M LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
      7/17/2008 12:47:00 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=100000 LimitPrice=0 StopPrice=0 SignalName=Buy to cover' FromEntrySignal='' Reason='There already is a matching, terminal exit order in place'
      Getting out Short SH
      106.68
      2nd Short SH, all out
      7/17/2008 12:47:00 PM Entered internal PlaceOrder() method at 7/17/2008 12:47:00 PM: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
      7/17/2008 12:47:00 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName=Buy to cover' FromEntrySignal='' Reason='There already is a matching, terminal exit order in place'
      106.68

      The first try was my original code, and the second was the extra code I added. Looks like they are both working, but I don't understand the reason why it won't be executed. There are no pending orders listed in the control center and I did not code any other weird exits.

      Comment


        #4
        Later, it does get out, but only when my script is telling it to re-buy. Here is the log.

        7/17/2008 12:51:44 PM Entered internal PlaceOrder() method at 7/17/2008 12:51:44 PM: Action=Buy OrderType=Market Quantity=0.2M LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
        Got in Long, x = 0
        106.72
        106.68
        7/17/2008 12:52:00 PM
        7/17/2008 12:51:45 PM Cancelled remaining exit order: Order='52f9779e65dc4bacb4bfbd664f5366c2/Sim101' Name='Close position' State=Filled Instrument='$USDJPY' Action=BuyToCover Limit price=0 Stop price=0 Quantity=0.1M Strategy='Pipper' Type=Market Tif=Gtc Oco='' Filled=100000 Fill price=106.72 Token='52f9779e65dc4bacb4bfbd664f5366c2' Gtd='12/1/2099 12:00:00 AM'
        7/17/2008 12:51:45 PM Cancelled remaining exit order: Order='f511e7f0a30d4f5aa9cb9174fb1a5e81/Sim101' Name='Buy to cover' State=Filled Instrument='$USDJPY' Action=BuyToCover Limit price=0 Stop price=0 Quantity=0.1M Strategy='Pipper' Type=Market Tif=Gtc Oco='' Filled=100000 Fill price=106.7 Token='f511e7f0a30d4f5aa9cb9174fb1a5e81' Gtd='12/1/2099 12:00:00 AM'
        FirstTick

        Comment


          #5
          See near bottom of page "Internal Order Handling...."

          RayNinjaTrader Customer Service

          Comment


            #6
            All my orders are market orders and I do not have any Set commands, no stop losses, so the internal order handling rules don't seem applicable.

            It seems there are hidden pending orders somewhere - how can I see where they are so that I can track where they came from?

            Comment


              #7
              Will come back to you.
              RayNinjaTrader Customer Service

              Comment


                #8
                Hi Ari Gold,

                The solution is to use two uniquely named entry signals. You would use a blank fromEntrySignal parameter if you wish to exit the whole position or you can call the various signal names to exit in portions.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thank You Josh!

                  Looks like it's fixed - now to try it on real data next week...

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by hazylizard, Today, 08:38 AM
                  2 responses
                  9 views
                  0 likes
                  Last Post hazylizard  
                  Started by geddyisodin, Today, 05:20 AM
                  2 responses
                  18 views
                  0 likes
                  Last Post geddyisodin  
                  Started by Max238, Today, 01:28 AM
                  5 responses
                  47 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by giulyko00, Yesterday, 12:03 PM
                  3 responses
                  13 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by habeebft, Today, 07:27 AM
                  1 response
                  16 views
                  0 likes
                  Last Post NinjaTrader_ChristopherS  
                  Working...
                  X