• 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 Bmatarese, Today, 03:27 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by Kei78, Today, 03:26 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by Jorge.andres.o, Today, 03:44 PM
        0 responses
        5 views
        0 likes
        Last Post Jorge.andres.o  
        Started by r3n3v, Today, 03:43 PM
        2 responses
        6 views
        0 likes
        Last Post r3n3v
        by r3n3v
         
        Started by bosajin, Today, 02:06 PM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Working...
        X