Announcement

Collapse
No announcement yet.

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;

    Comment


      #3
      Nice! Works ! Thx !!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X