Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

counting particular executions

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

    counting particular executions

    Is there a way to count which conditional statement submitted the order for a particular execution?

    For example, if there are 3 ways in which a intraday, long-only, 1 contract at a time strategy gets flattened, is there any way to use a few variables to count up how many of each occurred? For example, out of 100 position closes, 40 initial stops, 40 trailing and 20 end of day stops might have happened.

    Thanks much,

    #2
    Sure. Where you are doing EnterLong() or whatever just have an int counter that is incrementing. Every time EnterLong() is triggered your counter will increase by one.

    If your condition keeps evaluating to true and you are using EntriesPerDirection to limit your trades then this may be a bit more difficult. In that case you may need to modify your conditions to reflect your need.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I did think of that, but I'm having trouble with the limit and stop orders. If I enter it into the conditional logic, it will count the orders that are placed, not the executions themselves. For example, if a strategy submits a enterlonglimit after certain conditions are met and there is a counter, it will add 1 for the order that was entered regardless of whether it executes or not.

      Comment


        #4
        In that case you will need to some more involved programming. Maybe something that checks to see where the signal is coming from via a bool. Then after that bool is true check for changes in position quantity. Then increase a counter.

        Alternatively, you can try using the OnExecution() method and increment your counter from there. Problem with this is that if you get partial fills you will get multiple execution events for the same order.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thank you

          Your advice to use OnExecution() worked brilliantly!

          The only thing that I had trouble with in the end was the total tally. The strategy driven exits were not adding up to the number of entries. I discovered that since I have my own end-of-day stop out, it works great on full trading days. Unfortunately, on days that aren't full trading days and the system closes out at the end of the defined session, the exit trade does not get counted.

          My 2 follow on questions are:

          1) Is there any way to count the market on close orders that are driven by the Strategy Analyzer?

          2) Are there any ways to keep the system from trading on 1/2 days (like Thanksgiving Friday etc.)?

          Comment


            #6
            1) If you did not receive an OnExecution() event then unfortunately not.

            2) You can limit these days by defining them as days not to process any logic. Please see the time filter example, but instead of using ToTime() use ToDay() and filter out certain dates. http://www.ninjatrader-support.com/v...ead.php?t=3226
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            607 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            353 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X