Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TradeCollection Class

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

    TradeCollection Class

    In the TradeCollection Class documentation there is the following line;
    "You can access a trade object by providing an index value. Index value are zero based meaning the most recent trade taken in a strategy will be at an index value of zero."
    Should that not read as follows: "...the most recent trade taken in a strategy will be at an index value of the number of trades in a collection - 1.

    Then there is the following sample code;
    Trade firstTrade = Performance.AllTrades[0];
    Trade lastTrade = Performance.AllTrades[Performance.AllTrades.Count - 1];
    This sample code appears to be back to front, or the description at the top should be changed as per my suggestion above.

    If the most recent trade has an index value of zero, then the variable in the sample code called "firstTrade" should not be assigned the value of Performance. AllTrades[0]. And the lastTrade variable should have the zero index value assigned to it.

    Please confirm.
    Last edited by astrolobe; 09-20-2009, 06:42 PM.

    #2
    astrolobe, thanks for the pointer - you're correct those are reverse indexed meaning the first trade is at 0 the most recent one at Performance.RealtimeTrades.Count - 1.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    59 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X