Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization using account value

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

    Optimization using account value

    Is it possible to use the optimizer to optimize based on the cash value of the account (as opposed to "max. % profitable", etc)? I track the cash value of the account with a variable recalculated on each bar. I have checked this strategy and it runs correctly. I also wrote a strategy optimization type that returns this variable - NewAcntSize (code shown below) to be used in the optimization. This optimization type is displayed in the Strategy Analyzer "Optimize on..." dropdown menu.

    However, the optimizer does not appear to be using this variable (NewAcntSize) to perform the optimization. How do I change the optimization type strategy to make it use the account value as opposed to the standard optimization parameters. Thanks for your help.


    //
    // Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
    //
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Strategy;
    #endregion
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// </summary>
    [Gui.Design.DisplayName("Account Balance")]
    public class AccountBalance : OptimizationType
    {
    public double NewAcntSize;
    /// <summary>
    /// Return the performance value of a backtesting result.
    /// </summary>
    /// <param name="systemPerformance"></param>
    /// <returns></returns>
    public override double GetPerformanceValue(SystemPerformance systemPerformance)
    {
    return NewAcntSize; //AccountItem.CashValue;
    }
    }
    }

    #2
    Hi trader789, unfortunately working with custom optimization types is not supported - perhaps a community member is offering his insight if he worked into this territory before.

    Also: the CashValue accessed via the AccountItem would be 0 for backtesting use and only applicable then to realtime trading.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks, Bertrand. When you say it is not supported, are you saying that this particular type of operation cannot be done using NinjaTrader, or are you just saying that you do not provide support for this type of request in the forum? I am just wondering if it is possible to use a variable in a strategy to perform the optimization on? Please let me know. Thanks.

      Comment


        #4
        Hi trader789,

        Non supported means not documented, so we're unable to provide additional information on it. We avoid assessing feasibility on non-supported items because there is a lot more you can do in C# /.net than we can cover in support, and don't want to mislead one way or the other. We support the NinjaScript documented in our help guide and reference samples on these forums.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Barry Milan, Today, 10:35 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by WeyldFalcon, 12-10-2020, 06:48 PM
        14 responses
        1,428 views
        0 likes
        Last Post Handclap0241  
        Started by DJ888, Yesterday, 06:09 PM
        2 responses
        9 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        40 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Today, 08:51 AM
        2 responses
        16 views
        0 likes
        Last Post bill2023  
        Working...
        X