Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade with no PnL sharing between stocks

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

    Trade with no PnL sharing between stocks

    My preferred back test method is a list of stocks, where each stock gets a starting capital to trade. There is no profit or loss sharing between the stocks. Every new trade size is based on the last available cash amount for that specific stock as a result of the historical profit or loss of that specific stock.
    In NT I see that default you can only have either a fixed amount or a fixed quantity for each trade. So, I assume it will have to be done in the strategy itself.
    Can you help me on the way?
    Many thanks,

    #2
    Sylvestro,

    Within the strategy itself, you can use any formula you want to specify the order quantity. Are you familiar with making automated strategies?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      No, in NinjaScript I made some indicators, but I am just starting in automated strategies (I made some in MT4). So, I am looking for some examples that make the start more easy.
      Thanks

      Comment


        #4
        You can check into the Sample strategies we install with NT per default, or check out what's posted in the strategy subsection of the sharing section here -

        BertrandNinjaTrader Customer Service

        Comment


          #5
          I can see a number of my own indicators and a couple of strategies published, but up to now no example that would help me. I find it a bit starnge that it is not default implemented. Just testing with a fixed amount or quantity for every new trade does not give any real profit or loss at the end of the test, or am I wrong?

          Comment


            #6
            Sylvestro,

            For example, when EnterLong() is called.



            Its syntax is as follows :

            EnterLong(quantity,signalName);

            The quantity can be set in code to literally whatever you want as long as its an integer. Inside the strategy, you can keep track of historic profit and loss and use it for the calculation.

            Backtesting with a fixed quantity will give a profit or loss as long as the order entrance conditions are being satisfied.

            What feature are you referring to that you believe is not implemented by default? Could you clarify for us? I believe we are misunderstanding.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              What I want to say...

              I try to clarify with an example.
              The attachement "settings", shows my test settings. I am trading one stock with an account size of $2500.
              The result can be seen in the attachement "result".
              Here for every trade the quantity traded is for each trade adapted to a fixed account size of $2500 and the final % PnL is calculated on that.
              But, after the first trade my account is worth 8.55% less. So, I do not have $2500 but only $2286 to invest for the next trade.
              So, what does the final profit of 85.71% represent?

              What I want is to trade with the real amount available after the previous trade.
              Or is there an other way?
              Attached Files

              Comment


                #8
                Sylvestro,

                Cumulative profit is calculated as follows.

                Cumulative profit
                This statistic returns a value representing a summation of all the profits earned by all your trades. It can be interpreted as a performance measure for your strategy.

                Currency:

                SUM(profit * quantity * point value) of all trades

                Percent :

                PRODUCT(1 + profit / entry price) of all trades - 1

                Points :

                SUM(profit * quantity) of all trades

                where profit is defined as (exit price – entry price) for long trades and as (entry price – exit price) for short trades, quantity is defined as the number of contracts traded, and point value is defined as the monetary conversion of each point (e.g. 100 for currency pairs).

                Does this answer your question? Please let me know.
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  OK, Assume I have $1000.
                  I trade:
                  First trade: $1000 with stock at $10, I buy 100 next I sell at $11. I have now $1100
                  Second trade: $1100 with stock at $12, I buy 91 next I sell at $9. I have now $819
                  Third trade: $819 with stock at $10, I buy 82, next I sell at $12. I have now $984
                  A loss of $16.
                  Your back test:
                  First trade: $1000 with stock at $10, I buy 100 next I sell at $11. Result $100
                  Second trade: $1000 with stock at $12, I buy 83 next I sell at $9. Result -$253
                  Third trade: $1000 with stock at $10, I buy 100, next I sell at $12. Result $200
                  Sum= a profit of $47

                  Or I am still mising something, but this is not the same result!

                  Comment


                    #10
                    Sylvestro,

                    Yes, cumulative profit wouldn't list the actual account value. It only lists the profit or loss. The backtesting engine assumes that your account is 0 dollars, but there is no negative limit. Inside your strategy, you could setup some cash value for backtesting purposes. However, the cumulative profit still will not factor in the account value, only profit/loss. If you always use 1000 dollars for calculating how much quantity you want to order, you can do this inside the strategy.

                    You can track the account value yourself and specify any rules you want to determine order quantity inside your strategy. The profit and loss calculation will be using these rules, since it only concerns itself with the amount of money that was made or lost per trade.
                    Adam P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by geddyisodin, Yesterday, 05:20 AM
                    8 responses
                    49 views
                    0 likes
                    Last Post geddyisodin  
                    Started by DayTradingDEMON, Today, 09:28 AM
                    3 responses
                    19 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by Stanfillirenfro, Today, 07:23 AM
                    9 responses
                    23 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by George21, Today, 10:07 AM
                    0 responses
                    8 views
                    0 likes
                    Last Post George21  
                    Started by navyguy06, Today, 09:28 AM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X