Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Easy Event Question

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

    Easy Event Question

    can a single EnterLong call create two OnExecutionUpdate events?

    Code:
    EnterLong(1, "EL1");
    
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    {
    	if (execution.Order.Name.StartsWith("EL1"))
    	{
    		if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled)
      		{
    			++Cnt;
    			Print(Cnt.ToString() + " EnterLong");
    		}
     	}
    }

    #2
    Hello delTik,

    Thank you for your post.

    In the case of a quantity of it would only be expected to call OnExecutionUpdate() based on the event of that 1 quantity filling.

    Are you seeing something to the contrary? If so, are you using 'Set Order Quantity' as ' Default Quantity' and a specific 'Default Quantity' in the Strategies menu when enabling your strategy?

    Comment


      #3
      yes I'm counting (and debugging via Visual Studio) 2 events (StartsWith("EL1")) for a qty of 1.

      Set Order Quantity = Strategy.
      Last edited by delTik; 07-06-2016, 08:03 AM.

      Comment


        #4
        Hello delTik,

        Thank you for your response.

        Are you using 'Set Order Quantity' as ' Default Quantity' and a specific 'Default Quantity' in the Strategies menu when enabling your strategy?

        In addition, what are your settings for EntriesPerDirection and EntryHandling?

        Comment


          #5
          no, using

          Set Order Quantity: Strategy (with EnterLong(1, "EL1"))
          Entries Per Direction: 3
          Entry Handling: All Entries

          Comment


            #6
            Hello delTik,

            Thank you for your response.

            Is the intent to allow "EL1" to submit three entries?
            Using EntriesPerDirection = 3 would allow for multiple submissions of the "EL1" order and thus multiple executions.

            Comment


              #7
              ok I'll go back and check but if I call EnterLong(1, "EL1") only once should I expect only one execution event?

              Comment


                #8
                Originally posted by delTik View Post
                ok I'll go back and check but if I call EnterLong(1, "EL1") only once should I expect only one execution event?
                If the condition returns true multiple times and your have EntriesPerDirection set up to allow for multiple entries, then multiple submissions of the EnterLong() will occur, one for each time the condition is true up to the EntriesPerDirection.

                Comment


                  #9
                  ok thanks but confused ..

                  so if I call EnterLong(1, "EL1") once then the number of execution events raised will equal EntriesPerDirection, not one for each EnterLong call?

                  can I ask what the purpose of "EntriesPerDirection" is?

                  although I'd need to re-confirm this at the moment for a single EnterLong(1, "EL1") call with EntriesPerDirection = 3 I'm getting 2 execution events.
                  Last edited by delTik; 07-11-2016, 03:13 AM.

                  Comment


                    #10
                    Hello delTik,

                    Thank you for your response.

                    EntriesPerDirection sets the number of entries per side based on the EntryHandling.

                    If you set EntryHandling to AllEntries and use 3 for your EntriesPerDirection, then each time your condition returns true to place an order up to three times, it will place that order. If it only sees the condition twice it will only submit it twice.

                    EntriesPerDirection does not duplicate your order on the same bar, but if the condition to place the order returns true on another bar afterwards then it will submit another entry.

                    Comment


                      #11
                      Originally posted by NinjaTrader_PatrickH View Post
                      ...
                      EntriesPerDirection does not duplicate your order on the same bar, but if the condition to place the order returns true on another bar afterwards then it will submit another entry.
                      That is only true of COBC = false, in which case the point is moot anyway, as the trade conditions evaluation takes place only once per bar, there being only one tick per bar. If COBC = false, one can get whipsawed multiple times on the same bar. In fact, the very first piece of code that I posted in the File Sharing section of the forum, was to deal with that exact scenario.

                      By the same token, if there are no valid exit conditions on the bar, one can get filled multiple times on the bar.

                      Comment


                        #12
                        sorry but confused (again) ... my code only allows a single EnterLong(1, "EL1") call regardless of COBC = True or False, whipsawing or anything else.

                        unless I've totally misunderstood, should I not expect a single execution confirmation event for a single call of EnterLong?
                        Last edited by delTik; 07-15-2016, 10:20 AM.

                        Comment


                          #13
                          Originally posted by delTik View Post
                          sorry but confused (again) ... my code only allows a single EnterLong(1, "EL1") call regardless of COBC = True or False, whipsawing or anything else.

                          unless I've totally misunderstood, should I not expect a single execution confirmation event for a single call of EnterLong?
                          Let's start from the beginning and we can give you a walk through. What is the condition for entry?

                          Comment


                            #14
                            should I not expect a single execution confirmation event for a single call of EnterLong?
                            Yes, one confirmation per one call, but there can be more than one entry call on a bar, if COBC is false, and the conditions for entry occur more than once in the bar. If COBC is true, there is only one tick per bar, and so also only one entry.

                            Comment


                              #15
                              intialize v=0;

                              if(v<1)
                              {
                              EnterLong(1,"EL1");
                              v = 1;
                              }

                              busy right now but I'll attach a simply strategy tomorrow to save time. thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              571 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              330 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              548 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              549 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X