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

OptimizationFitnesses, Limit Orders

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

    OptimizationFitnesses, Limit Orders

    I'd like to write an OptimizationFitness that shows how many trades were closed by a limit order. How do I do that (ie, is there a way to count the number of trades that were opened / closed by a particular limit order?)

    (I've written several OptimizationFitnesses (and they work well, thank you), so writing them isn't a challenge. My challenge here is to get to that particular data. In looking thru the Help Guide, I don't see how this is done. eg, I don't see this is an option in "strategy.SystemPerformance.AllTrades.
    TradesPerformance​".)

    #2
    Hello spottysallrite,

    You can use the following to select all trades where a exit limit order was used:

    Code:
    List<Trade> limitExits = strategy.SystemPerformance.AllTrades.Where(o => o.Exit.Order.OrderType == Cbi.OrderType.Limit).ToList();
    int count = limitExits.Count;
    JesseNinjaTrader Customer Service

    Comment


      #3
      Nice! Works ! Thx !!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DJ888, Today, 10:57 PM
      0 responses
      2 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      158 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Today, 09:29 PM
      0 responses
      7 views
      0 likes
      Last Post Belfortbucks  
      Started by zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      151 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Working...
      X