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

Partial Exit signal

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

    Partial Exit signal

    Hello. Can I close one entry signal by using two different exit signals?

    Such as:

    // Open LONG position
    EnterLong(10)

    // Close first 5
    ExitLong(5)

    // After a few minutes close the other
    ExitLong(5)

    When I use similar commands in My Strategy, the second ExitLong is Ignored, for the reason "There already is a matching, filled exit order in place", despite the fact that the position is still 5L.

    Thank you in advance

    #2
    mix.net, are you specifying entry and exit signal names? If not, please try that because that would force NinjaTrader to look at the specific matching signals. Could you post the complete code so that we can see if anything else looks out of place?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      The strategy looks for some data in my own SQL database and based on that data it calls Enter or Exit functions. The signal names don't collide.

      I suppose posting complete code wouldn't be helpful, so I post just extracts.

      // this is done for mQuantity = 5
      IOrder mOrder1 = EnterLong(mQuantity, "aaa");

      After some period of time the strategy makes the first exit call:

      // this is done for mQuantity = 3
      IOrder mOrder2 = ExitLong(mQuantity, "bbb1", "aaa");

      And after another period of time the strategy makes the second exit call:

      // this is done for mQuantity = 2
      IOrder mOrder2 = ExitLong(mQuantity, "bbb2", "aaa");

      When I specify names like in the sample above, the result in the order trace looks like this:

      14.7.2010 19:49:15 Entered internal PlaceOrder() method at 14.7.2010 19:49:15: Action=Buy OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='aaa' FromEntrySignal=''

      14.7.2010 19:49:25 Entered internal PlaceOrder() method at 14.7.2010 19:49:25: Action=Sell OrderType=Market Quantity=3 LimitPrice=0 StopPrice=0 SignalName='bbb1' FromEntrySignal='aaa'

      14.7.2010 19:49:35 Entered internal PlaceOrder() method at 14.7.2010 19:49:35: Action=Sell OrderType=Market Quantity=2 LimitPrice=0 StopPrice=0 SignalName='bbb2' FromEntrySignal='aaa'

      14.7.2010 19:49:35 Ignored PlaceOrder() method at 14.7.2010 19:49:35: Action=Sell OrderType=Market Quantity=-1 LimitPrice=0 StopPrice=0 SignalName='bbb2' FromEntrySignal='aaa' Reason='There is no remaining quantity to exit'

      When I don't specify the signal names, the result is similar:

      14.7.2010 20:08:00 Entered internal PlaceOrder() method at 14.7.2010 20:08:00: Action=Buy OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

      14.7.2010 20:08:10 Entered internal PlaceOrder() method at 14.7.2010 20:08:10: Action=Sell OrderType=Market Quantity=3 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

      14.7.2010 20:08:30 Entered internal PlaceOrder() method at 14.7.2010 20:08:30: Action=Sell OrderType=Market Quantity=2 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

      14.7.2010 20:08:30 Ignored PlaceOrder() method: Action=Sell OrderType=Market Quantity=2 LimitPrice=0 StopPrice=0 SignalName=Sell' FromEntrySignal='' Reason='There already is a matching, filled exit order in place'

      Comment


        #4
        mix.net, in the first set of order traces, it lists a quantity of -1 for the bbb2 exit. Could this be part of the problem?

        I created a simple script to test this out on my end and everything worked as expected:
        Code:
        protected override void OnBarUpdate()
        {
            if (CurrentBar == 100)
            {
                IOrder entryOrder = EnterLong(10, "long entry");
            }
            else if (CurrentBar == 110)
            {
                IOrder exitOrder1 = ExitLong(5, "exit 1", "long entry");
            }
            else if (CurrentBar == 120)
            {
                IOrder exitOrder2 = ExitLong(5, "exit 2", "long entry");
            }
        }
        The output is as follows:
        Code:
        7/13/2010 8:41:00 AM Entered internal PlaceOrder() method at 7/13/2010 8:41:00 AM: Action=Buy OrderType=Market Quantity=10 LimitPrice=0 StopPrice=0 SignalName='long entry' FromEntrySignal=''
        7/13/2010 8:51:00 AM Entered internal PlaceOrder() method at 7/13/2010 8:51:00 AM: Action=Sell OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='exit 1' FromEntrySignal='long entry'
        7/13/2010 9:01:00 AM Entered internal PlaceOrder() method at 7/13/2010 9:01:00 AM: Action=Sell OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='exit 2' FromEntrySignal='long entry'
        If you could strip down your strategy to a more basic version that doesn't require the SQL connection but still exhibits this behavior, I'd like to test it because at this point, it appears to be a coding issue.
        Attached Files
        AustinNinjaTrader Customer Service

        Comment


          #5
          I replaced the DB queries by incrementing and checking a counter for the strategy to became more simple

          Code:
          [SIZE=2][FONT=Courier New][COLOR=#0000ff][SIZE=2][FONT=Courier New][COLOR=#0000ff][SIZE=2][FONT=Courier New][COLOR=#0000ff]private [/COLOR][/FONT][/SIZE][/COLOR][/FONT][/SIZE][/COLOR][/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][COLOR=#000000] tCount = [/COLOR][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][COLOR=#000000];[/COLOR][/SIZE][/FONT]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] System.Windows.Forms.Timer mTimer;[/SIZE][/FONT]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] OnStart()[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]mTimer = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] System.Windows.Forms.Timer();[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]mTimer.Interval = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1000[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]mTimer.Tick += [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] EventHandler(TimerEvent);[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]mTimer.Enabled = [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]mTimer.Start();[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]private [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] TimerEvent(Object myObject, EventArgs myEventArgs)[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]TriggerCustomEvent(mTick, [/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]private [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] mTick([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]object[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] state)[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE][/SIZE][/FONT]
          [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2](tCount == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]EnterLong([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]10[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"long entry"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT][/SIZE][/FONT]
          [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2](tCount == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]ExitLong([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]5[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"exit1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"long entry"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT][/SIZE][/FONT]
          [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2](tCount == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]ExitLong([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]5[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"exit2"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"long entry"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT][/SIZE][/FONT]
           
          [SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]tCount++;[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
          [/FONT][/SIZE]
          Attached Files

          Comment


            #6
            (continuation of the previous post)
            However, the problem remained. The first EXIT signal is entered OK, but the second EXIT is ignored:

            Code:
            15.7.2010 19:04:23 Entered internal PlaceOrder() method at 15.7.2010 19:04:23: Action=Buy OrderType=Market Quantity=10 LimitPrice=0 StopPrice=0 SignalName='long entry' FromEntrySignal=''
             
            15.7.2010 19:04:24 Entered internal PlaceOrder() method at 15.7.2010 19:04:24: Action=Sell OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='exit 1' FromEntrySignal='long entry'
             
            15.7.2010 19:04:25 Entered internal PlaceOrder() method at 15.7.2010 19:04:25: Action=Sell OrderType=Market Quantity=5 LimitPrice=0 StopPrice=0 SignalName='exit 2' FromEntrySignal='long entry'
             
            15.7.2010 19:04:25 Ignored PlaceOrder() method at 15.7.2010 19:04:25: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='exit 2' FromEntrySignal='long entry' Reason='There is no remaining quantity to exit'
            I'm using NinjaTrader 7 beta 18. Your simple test script worked OK for me.

            Thank you for your help

            Comment


              #7
              mix.net, would you mind trying to start your Time up in OnStartUp() instead? Also: Do you see the same issue happen when working with the IOrder objects as Austin's test did?
              BertrandNinjaTrader Customer Service

              Comment


                #8
                When I initialize and start the Timer in the OnStartUp method, the problem remains, nothing changes.

                I tried Austin's test (using OnBarUpdate method) in my NinjaTrader and it worked OK.

                When working with IOrder objects in my sample (using timer ticks) the problem remains the same, the second ExitLong method returns null instead of an IOrder object.

                That means when I call the Exit methods in the OnBarUpdate method, it works OK, but when I call them similarly in the Timer tick method, the second Exit order is ignored.

                Comment


                  #9
                  mix.net,

                  In your code you use OnStart(). This is not the OnStartUp() method that is required. Please amend the code to use OnStartUp().
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    I'm not sure that I understand you correctly.

                    I tried initializing and starting the timer in OnStartUp() method, but the problem remained. Should there be a difference?
                    Attached Files

                    Comment


                      #11
                      In your code you created a Forms.Timer object but you have not added one of the required using declarations.

                      using System.Windows.Forms;
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        I tried it, but adding the using declaration didn't make any change.

                        The timer is working correctly, but the second EXIT order (in the third tick of the timer) is ignored with reason "There is no remaining quantity to exit", although when putting the same code in OnBarUpdate method instead of timer tick method, both exit orders are processed with no problem.

                        Therefore I suppose there may be some issue with threading, that causes bad processing of the second EXIT call. The second ExitLong function call returns null, instead of an IOrder object.

                        Thank you for your patiance

                        Comment


                          #13
                          mix.net,

                          To scale-out, you will need to scale-in first. Please split your entry order into two separate orders with different signal names. Then call the exit orders on each signal name individually.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            OK, thank you.

                            Just for me to be informed: why does it work, when I call the methods from OnBarUpdate method, while it doesn't work when called from timer tick methods?

                            Comment


                              #15
                              mix.net, you're likely hitting a race condition here with the timers - do you see the same if you increase the timing to produce a later second Exit call?
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, 04-17-2024, 06:40 PM
                              3 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by bmartz, 03-12-2024, 06:12 AM
                              3 responses
                              27 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by Aviram Y, Today, 05:29 AM
                              2 responses
                              8 views
                              0 likes
                              Last Post Aviram Y  
                              Started by gentlebenthebear, Today, 01:30 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by cls71, Today, 04:45 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X