Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Weekly/Monthly PNL

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

    Weekly/Monthly PNL

    Will someone point me in the right direction for calculating the weekly or monthly PNL for a strategy for the purpose of shutting a strategy down when certain thresholds are breached similar to this example: http://www.ninjatrader.com/support/f...ad.php?t=19289? Thank you!

    - CableTrader007

    #2
    CableTrader007,

    Thank you for your post.

    The example will do exactly this, however you will need to keep the strategy running 24/7, and then track the PnL and when to stop the strategy.

    If you are looking to shut down the strategy down each day and try to pick up from the previous day, you will need to store the PnL value to an external source so that you can pick up the next day and get the leftover value.

    http://www.ninjatrader.com/support/f...ead.php?t=3477

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

    Comment


      #3
      I am looking for something as simple as:

      psuedocode:

      if first day of month
      - monthlypnl = 0;

      then each new day/trade adds/removes the trade pnl from that number.

      So, each month the value equals 0 and then changes to the monthly pnl (live and historical). There has to be something more simple than writing to an external file for this? Thank you!

      - CableTrader007

      Comment


        #4
        CableTrader007,

        You can check for a new month using DateTime structure.

        The check below will look at the Timestamp of the bars and compare the Months, if they are not equal then we have a new month

        if(Time[1].Month != Time[0].Month)
        {
        // reset values here
        }
        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
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 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
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X