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 algospoke, Yesterday, 06:40 PM
    2 responses
    23 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    45 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    22 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    181 views
    0 likes
    Last Post jeronymite  
    Working...
    X