Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

get the value of a specific range of trades

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

    get the value of a specific range of trades

    hi all,

    Code:
    	 
     double equity = 0;
    foreach( Trade myTrade in SystemPerformance.AllTrades)
    equity = equity + myTrade.ProfitCurrency;
    	  
    Print("l'equity è" + equity);
    with this code im tryng to get a cum profit based on trade objects
    Is it possible to do calculation with a range of Trades?
    for example can i do something like this?
    Code:
    	  double equity = 0;
    	  foreach( Trade myTrade in SystemPerformance.AllTrades[" here a range like trade 1 to  trade 20)
    	  equity = equity + myTrade.ProfitCurrency;
    	  
    	  Print("l'equity è" + equity);
    thank you in advance

    #2
    Hello maxwellreturn,

    There is <TradeCollection>.GetTrades() method.. However, this comes from a position and number of positions ago.


    I don't think this is what you are looking for and I don't think a GetTrades by range exists. It would be necessary to loop through the trades and add these to an array or collection if you would like.

    Would you like to submit a feature request for the NinjaTrader development to consider adding a get trades by range method to the TradeCollection object type in a future version of NinjaTrader?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      yes thank you chelsea,
      it s like create a series where the bars are replaced by trade object

      I don't think this is what you are looking for and I don't think a GetTrades by range exists. It would be necessary to loop through the trades and add these to an array or collection if you would like.
      how can i create an array or a collection in this way?there is some examples? thank you in advance and good year

      Comment


        #4
        Hello maxwellreturn,

        Below I am providing a publicly available link to a 3rd party education site on arrays and lists in C#.

        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        110 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        59 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        37 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        41 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        78 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X