• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    https://ninjatrader.com/support/help.../gettrades.htm

    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#.
        https://www.dotnetperls.com/array
        https://www.dotnetperls.com/list
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jeliner, 02-05-2019, 09:01 AM
        6 responses
        338 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by pmallya.nt, Today, 12:55 PM
        0 responses
        16 views
        0 likes
        Last Post pmallya.nt  
        Started by itrader46, Today, 12:39 PM
        2 responses
        6 views
        0 likes
        Last Post itrader46  
        Started by rtwave, Today, 12:46 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by Zeos6, Today, 11:45 AM
        2 responses
        8 views
        0 likes
        Last Post Zeos6
        by Zeos6
         
        Working...
        X