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 management. Portfolio

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

    Position management. Portfolio

    Hello.
    1) Where can I see tips or samples of using money management etc.
    For example, I don't want to use currency in strategy and just want to reduce amount of instrument in size. 1usdcad, 1 MSFT, 0.9usdcad, 0.9MSFT...

    2) Can I analyze and trade several instruments in Strategy Analyzer? How can I check Instrument list via script? Can I check the instrument list for condition execution and trade portfolio of instruments?

    #2
    Hello Alexstox.

    Thank you for your post.

    1) See the reference sample below on Money Management -
    http://www.ninjatrader.com/support/f...ead.php?t=4084

    2)You would only be able to test one instrument at a time in the Strategy Analyzer.
    However, your multi-timeframe orders will show up in the results
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      How can I change quantity of order as double?

      Hello. How can I change quantity of order as double?
      For example, I trade forex EURUSD. And I want to increase or reduce quantity in size and it should be 0.1 contract or 0.5 or 1.3. Is it possible? And what you can advise me if not?

      Comment


        #4
        I did something like this
        Code:
        [FONT="Courier New"] protected override void OnBarUpdate()
                {
        if (BarsInProgress==0) //start BarsInProgress for general instrument
        {
        if(Performance.AllTrades.Count>=1)
        	{			
        	Trade myTrade = Performance.AllTrades[Performance.AllTrades.Count - 1];
        			
        	if(myTrade.Entry.Name=="Long1" && myTrade.ProfitPoints>0) LQuantity1=QuantityMultiplier*LQuantity1;
        	if(myTrade.Entry.Name=="Long2" && myTrade.ProfitPoints>0) LQuantity2=QuantityMultiplier*LQuantity2;
        	if(myTrade.Entry.Name=="Long3" && myTrade.ProfitPoints>0) LQuantity3=QuantityMultiplier*LQuantity3;
        	if(myTrade.Entry.Name=="Short1" && myTrade.ProfitPoints>0) SQuantity1=QuantityMultiplier*SQuantity1;
        	if(myTrade.Entry.Name=="Short2" && myTrade.ProfitPoints>0) SQuantity2=QuantityMultiplier*SQuantity2;
        	if(myTrade.Entry.Name=="Short3" && myTrade.ProfitPoints>0) SQuantity3=QuantityMultiplier*SQuantity3;
                      }
        than entry rules goes[/FONT]
        But quantity in orders didn't change

        Comment


          #5
          alexstox, if you run your script what are the EntryHandling settings and by what property is order qty chosen by? ByStrategy?

          To clarify on the portfolio question, there would not be full portfolio backtesting available unfortunately, however a basket test over multiple instruments / a list could be run - http://www.ninjatrader.com/support/h...asket_test.htm
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Bertrand View Post
            alexstox, if you run your script what are the EntryHandling settings and by what property is order qty chosen by? ByStrategy?

            To clarify on the portfolio question, there would not be full portfolio backtesting available unfortunately, however a basket test over multiple instruments / a list could be run - http://www.ninjatrader.com/support/h...asket_test.htm
            EntryHandling = EntryHandling.UniqueEntries;

            Order qty was "DefaultQuantity". Than I tried to manage qty and change to my variables.

            I just need to reduce qty after loss and increase qty after profit. So, what is wrong in #4 post script. What you can advise?
            Last edited by alexstox; 02-24-2014, 01:27 PM.

            Comment


              #7
              Well, I tried to do that in OnExecution(), where I manage all orders (Long1,2,3 and Short1,2,3). So, as always I need to think of coonditions by myself. I will write when try something.

              Comment


                #8
                Difference between Total Net Profit and Cumulative Profit

                1) Good day to you! Why in Strategy Analyzer stat Total Net Profit != Cumulative Profit ?
                Click image for larger version

Name:	profit.PNG
Views:	1
Size:	3.4 KB
ID:	870825

                2) There are unique entries. How to get profit/loss from one of unique entry? For example, position's 1 trailOrder1 was executed. How to get profit from it?

                3) How to use double with int? Because % as double, quantity in orders as int. E.g. I need 10% from AccountSize: quantity = 0.01*AccountSize
                I've found on 3rd question how: yourInt=(int)yourDouble
                Last edited by alexstox; 07-17-2014, 08:38 AM.

                Comment


                  #9
                  Alexstox,

                  What part of the Strategy Analyzer are you looking at for those numbers?

                  With the Unique Entries, you can look for a specific trade with the signal name using the below -
                  http://www.ninjatrader.com/support/h...?gettrades.htm
                  http://www.ninjatrader.com/support/h...erformance.htm

                  Correct, you can cast the double as an (int) as you have done
                  Cal H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Cal View Post
                    Alexstox,

                    What part of the Strategy Analyzer are you looking at for those numbers?

                    With the Unique Entries, you can look for a specific trade with the signal name using the below -
                    http://www.ninjatrader.com/support/h...?gettrades.htm
                    http://www.ninjatrader.com/support/h...erformance.htm

                    Correct, you can cast the double as an (int) as you have done
                    1. Strategy Analyzer - Summary. I backtasted EURUSD. So, if CumProfit=52.51% and orderquantity=1, TotalNetProfit should be = 0.5251*1=0.5251. But it = 0.57. Why?

                    Comment


                      #11
                      Was this from a regular backtest, optimizer, or walk forward optimization?
                      Cal H.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Cal View Post
                        Was this from a regular backtest, optimizer, or walk forward optimization?
                        backtest

                        Comment


                          #13
                          Alexstox,

                          The CumProfit in percentage is a ratio return where the Total Net Profit is showing Monetary value. Try changing the drop down in the top of the Strategy Analyzer to Currency to have these two match up
                          Cal H.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Cal View Post
                            Alexstox,

                            The CumProfit in percentage is a ratio return where the Total Net Profit is showing Monetary value. Try changing the drop down in the top of the Strategy Analyzer to Currency to have these two match up
                            Are you kidding? =))) I knew that. Let me explain what I mean.
                            orderquantity=1,
                            Let's imagine 2 trades: 1.39*1-1.38*1=0.01, 1.38-1.375=0.005
                            CumProf=0.01+0.005=0.015 or 1.5%
                            0.01/1=1%, 0.005/1=0.5% 1+0.5=1.5%

                            From example below:
                            CumProf=52.51% or 1*0.5251=0.5251 in points
                            TotalNetProfit=0.57. Why? Where my mistake?

                            Comment


                              #15
                              Alexstox,

                              CumProfit is based off of profit / entry price

                              Here is the formula for CumProfit with Percentage -
                              http://www.ninjatrader.com/support/h...efinitions.htm

                              Additionally, if you have a GrossLoss and GrossProfit showing, as your screenshot shows, you would have had at least two trades taken, not 1.
                              Cal H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Jimmyk, 01-26-2018, 05:19 AM
                              6 responses
                              835 views
                              0 likes
                              Last Post emuns
                              by emuns
                               
                              Started by jxs_xrj, 01-12-2020, 09:49 AM
                              6 responses
                              3,291 views
                              1 like
                              Last Post jgualdronc  
                              Started by Touch-Ups, Today, 10:36 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post Touch-Ups  
                              Started by geddyisodin, 04-25-2024, 05:20 AM
                              11 responses
                              62 views
                              0 likes
                              Last Post halgo_boulder  
                              Started by Option Whisperer, Today, 09:55 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Option Whisperer  
                              Working...
                              X