Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization Type for performance of last 'n' trades

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

    Optimization Type for performance of last 'n' trades

    Hello NinjaTraders,

    I have a strategy that requires optimization based on the performance of the most recent set of trades only. I'm trying to write an optimization type that accommodates this, but before I do could someone please answer:

    a) is it possible to pass in a variable to the optimization type code that allows you to specify the number of most recent trades to account for in the fitness test? Or must this number be hard-coded? (I'm fine with either way)

    b) What's the best approach to getting the performance of the last N trades? Is there a pre-defined method that can be used, or would I need to loop through each trade and add up the P/L for each one and do my own calculations?

    Thanks!

    -Dave

    #2
    Hello dave416,
    Thanks for your note.

    A. Yes, you can pass on a input parameter (public property) and access it from the Strategy property in the Optimization class.

    Say you have a property as MyInput then you can call it from the Optimizer as:
    Code:
    this.Strategy.MyInput
    B. You can use the TradeCollection object to retrive the trades.
    Code:
    this.Strategy.Performance.AllTrades
    Please do note the optimization class is not officially supported.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by lightsun47, Today, 03:51 PM
    0 responses
    4 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    8 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    44 views
    0 likes
    Last Post futtrader  
    Started by Option Whisperer, Today, 09:55 AM
    1 response
    13 views
    0 likes
    Last Post bltdavid  
    Started by port119, Today, 02:43 PM
    0 responses
    8 views
    0 likes
    Last Post port119
    by port119
     
    Working...
    X