Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy depends on last few trades PnL

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

    Strategy depends on last few trades PnL

    Hi guys,

    I am constructing a strategy based on my trading PnL. Do you have any idea on how to code it in NinjaTrader? I would like to know the number of my last recent five trades' win/loss. And to make that number as another indicator to trade in the future. I've tried to use performance class. But it is cumulatively calculated, which means if I did not trade in last few bars, it still gives me a positive/negative profit. Do you have any idea on how to calculating the real profit each trade gives me?

    Thanks!

    #2
    figoliuxi,

    Welcome to the forum!

    You could keep track of this yourself in some sort of data structure or the built in data series.

    In other words, when you detect an order has closed calculate PnL and store it somewhere.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks AdamP.
      Yeah, I agree with your opinion. But can you show me some sample codes/or method in NinjaTrader on calculate each trade's PnL and store it in a data series. The performance method seems give me cumulative PnL. Is there a way to reset the PnL to 0 each time I store a value?

      Thanks

      Comment


        #4
        Hello figoliuxi,
        You can use the trade collection to get the PnL of the trades.

        Please refer here to know more

        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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