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