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.

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 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