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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        72 views
        0 likes
        Last Post PaulMohn  
        Working...
        X