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

Account Management, Portfolio Management, Position Sizing, Multiple Strategies, etc.

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

    Account Management, Portfolio Management, Position Sizing, Multiple Strategies, etc.

    I find NinjaTrader very usable for short-term single/simple strategy testing and I like that is has the full power of C# behind it, but I'm finding it a little limiting in the ability to handle multiple strategies working together, position sizing, account management, risk/return balanced optimization, and longer term trading without quite a bit of manual coding. Here are some examples:

    - It isn't possible to automatically aggregate multiple strategies into a single portfolio-wide backtest/optimization run and have some sort of super-strategy that handles allocating capital between strategies based on current performance, expected performance, risk levels, market conditions, etc.

    - There isn't any built-in support for account management such as obtaining account balances (supposedly in NT7), simulating an account where the cash balance earns interest or has margin, etc.

    - In my opinion, none of the "optimize on" selections are good for strategies that need to optimize both returns and risk and where different optimization parameters result in different numbers of trades. A profit factor or 10:1 is great, but if a strategy can only make $10 per year and loses $1, it is not useful, since there are not enough trade signals. Similarly, optimizing on things like cumulated profit ignores drawdown/risk. There should be some built-in way to optimize on something like expectancy or SQN that takes $ earned per day (not per trade) and dampens it based on risk.

    - There is no built-in way to backtest what a starting account balance would have grown to over time, since there is no account value access to handle position sizing (even something simple like invest 100% of your current account balance in one strategy for 4 years, but definitely not something more complex where there are multiple strategies at once).

    - Especially people who trade longer term (daily/weekly/monthly), it is important to be able to compare a complete portfolio to a buy and hold type index's equity curve, etc.

    - Memory usage is much higher and performance is slower than similar tools I've used for large sequences of backtesting/optimization. NT always crashes on long optimizations at about 1.4 GB of memory, even if you have much more. I realize there are some .NET limits, but I believe NT should be much more frugal with memory so it never hits those limits. Performance-wise, I have not profiled the application (I recommend the AQTime tool for that), so I don't know what is making optimizations slower, but my manually coded optimizations can run up to 200X faster, though I'm using native code in a command line application, use multiple threads, and only do calculations for the numbers I personally want. One partial fix would be to include a genetic and/or random sampling optimizer as an option in addition to the brute force one available now, if the optimization can't be sped up and memory-optimized up for NT7.

    I realize that some of this can be simulated manually, and in many cases there is sample code available here but it takes manual coding/searching and various hacks to do most of these things. I also know that some of my requests fall outside the current customer base of NinjaTrader, but I'm listing them anyway in case they are useful. Thanks!
    Last edited by Anagoge; 12-03-2008, 10:16 PM.

    #2
    1. NT6.5 does not have "portfolio backtesting".
    2. NT7 will provide the ability to access account information for this purpose.
    3. You can create your own optimizer type. http://www.ninjatrader-support.com/H...mizerType.html This is outside the scope of what we can offer support for though.
    4. Sure there is. Set your strategy to calculate positions based on "by account size" in the "Order properties" when you are choosing your strategy.
    6. NT7 will bring many improvements in performance.

    Thank you for voicing your concerns.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Good suggestions.

      I'd really love to see optimize by expectancy and also built in support for different position sizing methodologies (fixed lot, fixed %, fixed ratio, fixed percent volatility, percent risk etc). Position size optimizing usually makes a greater overall impact on success than ANY other parameter.

      I've manually coded an indicator that returns a plot of the position size to a strategy, but its not the most elegant solutions by any means.

      Comment


        #4
        Originally posted by NinjaTrader_Josh View Post
        4. Sure there is. Set your strategy to calculate positions based on "by account size" in the "Order properties" when you are choosing your strategy.
        Thanks for your reply. That option is close, but it sets the position size based on a fixed value ("account starting value"), not the current account value, so you can't automatically do things like invest 100% of the account value in each trade, since the current account value is changing over time. You gave me the idea to manually set the AccountSize variable in code after every trade closes based on a calculation of a starting account size and the cumulated profit $, which might actually do what I want, but like Elliott Wave, I think it would be great if a future NT had some basic position sizing algorithms built-in.

        I'm looking forward to the NT7 backtesting performance/memory improvements. Thanks!

        Comment


          #5
          Anagoge, what I do in my strategies is pass the initial acct value (manual entered) as well as the realized and unrealized PnL to an indicator to calculate the current account equity and then returns a value based on the selected position sizing algorithm which is then used for the order quantity.

          The reason I used an indicator was to prevent having to manually code it into every strategy which is cumbersome.

          It appears to work but I haven't done enough testing to trust it live...

          Ideally these options would be in the OrderQuantity dropdown. I'm curious as to whether its possible to convert the indicator into a different format and stick it in the 'bin\Custom\Type' folder to accomplish this?

          This is well beyond my ability atm, but it would give hope to a solution coming from the user community rather than praying it somehow makes it onto the development teams already exceedingly long list of considerations.
          Last edited by Elliott Wave; 12-03-2008, 11:03 PM.

          Comment


            #6
            account size

            Elliot Wave,

            is there a reason why you don't use AccountSize instead of "initial acct value (manual entered)"?

            cheers,
            sysimp

            Comment


              #7
              As far as position sizing goes, here are some ideas from Wealth-Lab, for example:

              Static Positioning like NT 6.5:
              Fixed dollar amount per entry
              # of shares

              Portfolio Mode Positioning with a starting account value:
              Fixed dollar amount per entry
              # of shares
              Percent of total account equity
              Max percent risked
              Custom coded position sizing algorithms (PosSizer, SimuScripts)

              The current NT 6.5 default of one share per entry isn't ideal, for me, because the dollar amount per trade can change significantly based on the price of the instrument. This can lead to overweighting certain high instrument price periods within your backtest if you trade over volatile or long periods. TradingSolutions, for example, addresses this by defaulting to trading fractional shares so you can enter with the same dollar amount in each trade, and all trades carry equal weight in the backtest results.

              Comment


                #8
                As far as I know Wealth-Lab also uses C#, so if there is any relevant code on this topic for Wealth-Lab it hopefully wouldn't be too hard to port to NT.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Christopher_R, Today, 12:29 AM
                0 responses
                8 views
                0 likes
                Last Post Christopher_R  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                166 responses
                2,235 views
                0 likes
                Last Post sidlercom80  
                Started by thread, Yesterday, 11:58 PM
                0 responses
                3 views
                0 likes
                Last Post thread
                by thread
                 
                Started by jclose, Yesterday, 09:37 PM
                0 responses
                7 views
                0 likes
                Last Post jclose
                by jclose
                 
                Started by WeyldFalcon, 08-07-2020, 06:13 AM
                10 responses
                1,415 views
                0 likes
                Last Post Traderontheroad  
                Working...
                X