Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Position Sizing Custom Code

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

    Position Sizing Custom Code

    Has anyone developed any position sizing code that you could add to a strategy base class (@Strategy.cs or your own custom base class) and then be available to all descendant strategies. I was thinking about at least having a position sizing option based on % of current account value (starting account value + realized gains, not % of starting account value as NT has built-in) and maybe a few others such as a % of Optimal-F, a % of Kelly F, or fixed $ invested (allowing fractional shares).

    If I could ask for just two things for NT7, it would be support for custom performance metrics (so I can add monthly Sortino, SQN, a real Sharpe ratio [including unrealized gains], average rolling monthly/yearly returns, etc.) and more built-in position sizing algorithms (including a base class to add custom ones).
    Last edited by Anagoge; 04-20-2009, 01:18 AM.

    #2
    Originally posted by Anagoge View Post
    Has anyone developed any position sizing code that you could add to a strategy base class (@Strategy.cs or your own custom base class) and then be available to all descendant strategies. I was thinking about at least having a position sizing option based on % of current account value (starting account value + realized gains, not % of starting account value as NT has built-in) and maybe a few others such as a % of Optimal-F, a % of Kelly F, or fixed $ invested (allowing fractional shares).

    If I could ask for just two things for NT7, it would be support for custom performance metrics (so I can add monthly Sortino, SQN, a real Sharpe ratio [including unrealized gains], average rolling monthly/yearly returns, etc.) and more built-in position sizing algorithms (including a base class to add custom ones).
    Maybe this help a little http://www.ninjatrader-support2.com/...ad.php?t=11614

    Comment


      #3
      Hi Anagoge - thanks for the suggestions - what exactly are you looking for? To add your own metrics to the Strategy Analyzer pages?
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Yes, I would love to be able to add several custom strategy analyzer metrics to the result grids for backtests and optimizations and also have some more expansive built-in position sizing algorithms and/or a base class to add custom position sizing algorithms that would be selectable in any strategy.

        PRTester, I'll look at your position sizing code. It might be a good place to starting place to start implementing something close to what I need.

        Comment


          #5
          Anagoge,

          You can create your own metrics however you want and just export results to a file in strategy runtime. Would that not work?
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Yes, exporting to a file works, but I'd definitely rather be able to see the metrics inside the GUI and sort the optimizer grids by my custom metrics, etc. A tool similar to NT that I've used allows adding custom metrics to both individual trades and the strategy results using a method called AddCustomMetric. These custom metrics show up in the backtest/optimize result grids and can be sorted/filtered/exported/graphed just like the built-in metrics. I find this feature very powerful.

            Comment


              #7
              Thanks for your detailed input Anagoge.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by PrTester View Post
                I gave this a look and it helps. I managed to hack your code to implement percentage of current account size (0-100%) position sizes, and it helps in some sense, but there are still some issues. Because the account balance compounds (grows exponentially) now, the growth of the account in dollars graph needs to be a log scale, and the performance measures like cumulated profit should really be changed to the more commonly quoted cumulative profit of the actual account balance, but since we can't add custom performance measures to NT, this change was only a small win for me. That said, at least I learned a little more about the features and limitations of NT.

                [I'm aware of the dangers of backtesting/optimizing using cumulative profit type statistics, but I mainly need this number when showing a potential strategy to someone else who wants to see these statistics.]

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ETFVoyageur, 05-07-2024, 07:05 PM
                19 responses
                149 views
                0 likes
                Last Post ETFVoyageur  
                Started by ETFVoyageur, Yesterday, 10:13 PM
                3 responses
                26 views
                0 likes
                Last Post ETFVoyageur  
                Started by ETFVoyageur, Yesterday, 12:52 AM
                3 responses
                33 views
                0 likes
                Last Post ETFVoyageur  
                Started by ETFVoyageur, Today, 02:10 AM
                2 responses
                27 views
                0 likes
                Last Post ETFVoyageur  
                Started by ryan_21, Today, 08:46 PM
                1 response
                2 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X