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 terofs, Yesterday, 04:18 PM
    1 response
    21 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by CommonWhale, Today, 09:55 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by Gerik, Today, 09:40 AM
    2 responses
    7 views
    0 likes
    Last Post Gerik
    by Gerik
     
    Started by RookieTrader, Today, 09:37 AM
    2 responses
    13 views
    0 likes
    Last Post RookieTrader  
    Started by alifarahani, Today, 09:40 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X