Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit/Loss two trades ago

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

    Profit/Loss two trades ago

    Good Morning,

    Question,

    If the script for Profit/loss of last trades is:
    SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1].ProfitCurrency;

    is the profit and loss for two trades ago:
    SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 2].ProfitCurrency;

    This does not seem to work when I try it.

    #2
    Hello TraderRod,

    Thanks for the post.

    Are you seeing an error or what specifically do you see happening when using that?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      When I enter a -2 for two trades ago it returns the Profit and Loss of the last trade, not two trades ago.

      Comment


        #4
        Hello TraderRod,

        Just to clarify, you are saying that when you use - 2 you see the same information as the last trade in the collection or -1?

        The trades could potentially have the same value, are you seeing all other values of the trade object are the same?

        I tried the following print in the SampleMACrossOver and see this working.

        Code:
        if(SystemPerformance.AllTrades.Count < 2) return;
        Print(SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1].ProfitCurrency);
        Print(SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 2].ProfitCurrency);
        -12.5
        -262.5


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,603 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        8 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        4 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        12 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X