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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        153 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        89 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        133 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        128 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X