Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rithmic real time P&L

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

    Rithmic real time P&L

    I may be wrong about this but based on things I've read on here I am under the impression that there is some known issue regarding Ninja pulling real-time P&L data when using Rithmic for data and as a broker.

    My goal is to carefully control position and stop sizing as I approach a given daily loss limit.

    If this is true it has me thinking that I would need to create a global variable that gets updated with each trade's P&L using something like this:

    Code:
    protected override void OnBarUpdate()
    {
      if (SystemPerformance.RealTimeTrades.Count > 0)
      {
          // Check to make sure there is at least one trade in the collection
          Trade lastTrade = SystemPerformance.RealTimeTrad es[SystemPerformance.RealTimeTrades.Count - 1];
    
          // Calculate the PnL for the last completed real-time trade
          double lastProfitCurrency = lastTrade.ProfitCurr ency;
    
          // Store the quantity of the last completed real-time trade
          double lastTradeQty = lastTrade.Quantity;
    
          // Pring the PnL to the NinjaScript Output window
          Print("The last trade's profit in currency is " + lastProfitCurrency);
          // The trade profit is quantity aware, we can easily print the profit per traded unit as well
          Print("The last trade's profit in currency per traded unit is " + (lastProfitCurrency / lastTradeQty));
      }
    }


    In order to avoid re-inventing the wheel I wanted to make this post to run it past the fine folks at this forum to see if I'm on the right path or if I should adjust course?

    #2
    Hi WalterSkinner , thanks for posting. There is no known issue with PnL, I would need you to link where you heard this information. To track an open position unrealized PnL, use Position.GetUnrealizedPnL(), to read the information from trades the strategy has already completed, the SystemPerformance class is the correct tool to use.

    Kind regards,
    -ChrisL

    Comment


      #3
      Hi Chris,

      If you're not familiar with this "issue" I'm sure that means I am mistaken.

      Thanks for your help I will move forward with GetUnrealizedProfitLoss() and the SystemPerformance class.

      Have a great weekend!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      25 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      120 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X