Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder and Signal Names

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

    IOrder and Signal Names

    If I two different EnterLong orders that is assigned to two different IOrder, BUT share the same signal name, is it considered 1 order?

    For example:

    private IOrder longEntry1;
    private IOrder longEntry2;

    if (Close[0] > Open[0])
    {
    longEntry1 = EnterLong("SignalName");
    longEntry2 = EnterLong("SignalName");
    }

    Thanks.

    #2
    Hello nicbizz,

    Thank you for your post.

    The first order will be accepted, however the second order will be ignored.

    Using 'EntriesPerDirection = 2;' and 'EntryHandling = EntryHandling.AllEntries;' you will be able to have two separate orders process with the same signalName.

    For information on EntriesPerDirection please visit the following link: http://www.ninjatrader.com/support/h...rdirection.htm

    For information on EntryHandling please visit the following link: http://www.ninjatrader.com/support/h...ryhandling.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Hello Patrick,

      Thanks for the prompt reply!

      A somewhat related question(s):

      1) If I set EntriesPerDirection = 2, and both Long orders have the same signal name("Signal Name"), will ExitLong("SignalName") exit from both orders?

      2) If I code ExitLong() instead , without a fromSignalName, what happens?

      3) If I coded ExitLong(1,"exitSignal","SignalName") - note, only 1 lot was sold - how would I know which IOrder long was exited?

      Thanks!

      -Nick

      Comment


        #4
        Hello Nick,

        Thank you for your response.

        Using either ExitLong("signalName") or ExitLong() will result in both orders closing as they have the same signalName.

        With your third inquiry you would not know unless you gave them separate signalNames.
        Scaling out is only possible if first scaling in with different signalNames.

        For a reference sample on Scaling out of a position please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3751

        Please let me know if I may be of further assistance.

        Comment


          #5
          Thanks for the tip, Patrick!

          Comment


            #6
            Heya Patrick,

            Hope you can help with another Q, this time wit OnExecution().

            I would like it so that when both IOrders 'longEntry1' and 'longEntry2' are filled, to execute the following line of code:

            tradingSwitch = false;

            I know the logic should be run under OnExecution(), but how do I code to check if both IOrders are filled?

            Thanks!

            -Nick

            Comment


              #7
              Stab in the dark, would the following code work under OnExecution()?

              Code:
              if (longEntry1.OrderState == OrderState.Filled && longEntry2.OrderState == OrderState.Filled)
                    tradingSwitch = false;

              Comment


                #8
                And yet another related Q:

                Is it better to set

                longEntry1 = null;

                under OnExecution ---> execution.order.OrderState == Filled

                or OnOrderUpdate ---> order.OrderState == Filled ?

                In the Help Guide, we were advised to drive logic using OnExecution, yet the example given in OnOrderUpdate sets IOrders = null.

                Comment


                  #9
                  Hello nicbizz,

                  For driving logic on order fills you want to use OnExecution() handler. The approach to this is shown here in this sample:
                  The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()


                  It's raised independently for each order fill, so you would need to track with custom code when two separate orders are filled, like maybe a separate bool flag that is raised with each order fill.

                  Setting IOrders to null is best practice once you are done with the order object. This could be done in either place and it depends where you are working with the object exactly. OnExecution is dedicated to fills, and OnOrderUpdate() is any order state change. If you work with the object in OnExecution and you no longer need it, reset to null there. Otherwise if you work with the object in OnOrderUpdate and no longer need it, then reset to null there.
                  Last edited by NinjaTrader_RyanM1; 12-02-2011, 02:35 PM.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by argusthome, Yesterday, 10:06 AM
                  0 responses
                  20 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  18 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  14 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post TheRealMorford  
                  Started by Mindset, 02-28-2026, 06:16 AM
                  0 responses
                  38 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Working...
                  X