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 Kaledus, Today, 01:29 PM
        0 responses
        3 views
        0 likes
        Last Post Kaledus
        by Kaledus
         
        Started by PaulMohn, Today, 12:36 PM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by yertle, Yesterday, 08:38 AM
        8 responses
        36 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by rdtdale, Today, 01:02 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        3 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X