Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Share Service setup

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

    #16
    Hello,

    I got it to work this way:

    if (SystemPerformance.RealTimeTrades.Count > 0)
    {
    // Check to make sure there is at least one trade in the collection
    Trade lastTrade = SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count - 1];
    // Calculate the PnL for the last completed real-time trade
    double lastProfitCurrency = lastTrade.ProfitCurrency;

    if (lastTrade.Exit.Order.OrderState == OrderState.Filled && Position.MarketPosition == MarketPosition.Flat)
    {
    // Pring the PnL to the NinjaScript Output window
    //Print(Time[0] + "The last trade's profit in currency is " + lastProfitCurrency + "Cumulative profit of all trades is: " + " " + SystemPerformance.RealTimeTrades.TradesPerformance .Currency.CumProfit);
    SendMail("*********@txt.att.net", "Last Trade PnL Statement!",string.Format("{0} The last trade's profit in currency is: {1} Profits of all trades is: {2}", Time[0], lastProfitCurrency, SystemPerformance.RealTimeTrades.TradesPerformance .Currency.CumProfit));
    }
    }

    Did I do this correctly?

    Also, two things: Sometimes I don't receive an email until minutes after the trade. And I can't get the real time performance to reset at the close of the session.

    Comment


      #17
      Hi AdeptistJune, thanks for your reply. If you use Print() to print out the data it will confirm if you are getting the correct trade information or not. Use Print() to see when SendMail() is called as well, if you are seeing the print right as the trade is completed and you get a mail message a few minutes later, then it's the mail server being slow. The performance report will not reset until the strategy is disabled. You would need to keep track of the session performance within the script and reset the values when IsFirstBarOfSession= true.

      Comment


        #18
        Hi AdeptistJune, can you please share the code for mail shared service and maybe a guide or a link how to implement it in the NT8. I'm not very technical unfortunately.

        Thanks in advance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        54 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        131 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X