Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I see if the last trade was losing ?

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

    How can I see if the last trade was losing ?

    I want to adjust my order quantity based on the previous trade.

    I read a lot of threads where there are quite complex advices...and samples that have way too many variables and additional features that make it hard for a newbie like me.

    I just need to know how I can fetch the profit/loss of the previous trade.

    Something like this:
    If (previous trade profit <= 0 )
    {
    do something
    }

    Thanks.

    #2
    Hello nikolaalx,

    Thank you for your post.

    You would use the TradeCollection and GetTrades(): http://www.ninjatrader.com/support/h.../gettrades.htm

    Comment


      #3
      I would very much appreciate if you can give me an actual sample.

      I read that article ...as well as almost all others, but I guess I do not have the skills to acknowledge it.

      Comment


        #4
        Hello nikolaalx,

        Take the example in the link I sent you as a starting point:
        Code:
        TradeCollection myTrades = Performance.AllTrades.GetTrades("MSFT", "myEntrySignal", 1);
        Now take the myTrades object and pull the profit and loss from it:
        Code:
        myTrades.TradesPerformance.Currency.CumProfit

        Comment


          #5
          Thanks, however wouldn't "TradesPerformance.Currency.CumProfit" fetch the total accumulated profit ? I just need to see the last trade was <0 or >= 0

          Also can't I use it directly "TradesPerformance.Currency.CumProfit" without defining any features for a specific collection?

          Comment


            #6
            nikolaalx,

            You will need to use the TradeCollection to get the last trade to check for performance.
            http://www.ninjatrader.com/support/h...?gettrades.htm

            Let me know if I can be of further assistance.
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Multiple strategies

              If I am running multiple strategies on the same instrument at the same time, does trade collection include all of the trades from each of the strategies? For example, would the basic samplehaltbasicstrategy halt all of the enabled strategies at a $1000 profit or a $400 loss?

              Thx,

              Ken

              Comment


                #8
                Ken,

                The TradeCollection is going to be per strategy and not the account and total trades taken.
                Cal H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                647 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X