Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing Trades in OptimizationFitness

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

    Accessing Trades in OptimizationFitness

    2 questions:

    a) can I access the underlying trades OnCalculatePerformanceValue in an optimization fitness script? The AllTrades property seems to be empty when I step through it in the debugger. (it wasn't always that way was it?)

    b) StdDev in TradesPerformance object is represented on a per unit basis which doesn't help me as I'm looking for the stddev of the trade profit in currency. I was trying to calculate it myself (see a) above) but I can't figure out how to access the underlying trades.

    #2
    Hello,

    The OnCalculatePerformanceValue() is called in the script and allows you to set the value. Behind the scenes NT will call this method when performing the individual backtests to generate a performance rating for ranking for each test.
    (For example you could get a print for each optimization in the output window)



    If you are asking if you are able to access this from VisualStudio, this would be outside of what I am able to support.

    Attached is an example that loops through the trades and prints these to the output window.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,
      When I step through each OnCalculatePerformanceValue() call, the strategy.SystemPerformance.AllTrades collection isn't always populated. I believe this is a bug. Can you confirm you are seeing the same thing? I've attached the fitness method which prints to the output screen the details.
      Attached Files
      Last edited by GrumpyTrader; 04-09-2017, 09:08 PM.

      Comment


        #4
        Hello GrumpyTrader,

        I was able to reproduce and I have reported the behavior to our development.

        Thanks for reporting the behavior.

        Once I have a tracking ID for this report I will post in this thread for future reference.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi GrumpyTrader,

          I have received a tracking ID for this behavior where not all iterations are appearing when the Optimization Fitness is run.

          For future reference, this behavior is being tracked with ID #NTEIGHT-11564.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          77 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          45 views
          0 likes
          Last Post PaulMohn  
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          168 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          101 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          170 views
          2 likes
          Last Post CaptainJack  
          Working...
          X