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 charlesugo_1, 05-26-2026, 05:03 PM
                0 responses
                55 views
                0 likes
                Last Post charlesugo_1  
                Started by DannyP96, 05-18-2026, 02:38 PM
                1 response
                142 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 05-11-2026, 05:56 AM
                0 responses
                160 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 05-10-2026, 08:12 PM
                0 responses
                96 views
                0 likes
                Last Post CarlTrading  
                Started by Hwop38, 05-04-2026, 07:02 PM
                0 responses
                276 views
                0 likes
                Last Post Hwop38
                by Hwop38
                 
                Working...
                X