Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SystemPerformance.AllTrades.. doesn't work

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

    SystemPerformance.AllTrades.. doesn't work

    running the strategy on the last year data
    have 1 trade per day
    this
    SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1].ProfitCurrency
    every day gives the same value of the last trade (which was made yesterday 12 Nov 2020)
    I expect that the value will be relevant for the day in the past
    Code:
    bool isNewSession = sessionIterator.IsNewSession(Time[0],true);
    if (isNewSession)
    {
       if (SystemPerformance.AllTrades.Count > 1)    Print (SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1].ProfitCurrency ); 
    }
    what I get is
    321.12
    321.12
    321.12
    321.12
    321.12
    etc.

    what am I doing wrong please?

    #2
    Hello dadarara,

    Thank you for your post.

    Instead of using a session iterator, please try checking if (SystemPerformance.AllTrades.Count > 0). Then, check to make sure there is at least one trade in the collection using Trade. The code to do so would look as follows.

    Trade lastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1];

    Finally, print the lastTrade variable to the Output window.

    See the example in the Trade help guide link that demonstrates how this could be done - https://ninjatrader.com/support/help...nt8/?trade.htm

    If you have further questions, please provide an exported example script that demonstrates the behavior you are seeing so that we may further investigate this.

    Let us know if we may further assist.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Brandon

      same thing

      this is the code I use

      Code:
      if (SystemPerformance.AllTrades.Count > 0)
      {
        Trade trade1 = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1];
        Print( trade1.ProfitCurrency);
      }
      I get
      -391.38
      -391.38
      -391.38
      -391.38
      -391.38

      (changed because today I had a trade with a loss)

      its like the SystemPerformance.AllTrades is looking on the total trades in the system and not in the running strategy ...

      any ideas ?

      Comment


        #4
        Hello dadarara,

        Thank you for that information.

        Please send us an exported example script that demonstrates this behavior so we may further investigate this.

        Thanks in advance, I look forward to resolving this.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          sorry
          my bad
          found the problem
          thank you for your time.
          you guys are amazing your service in invaluable

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          61 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          134 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X