Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Regarding the RealTime Trades collection

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

    Regarding the RealTime Trades collection

    Hello,

    I'm trying to count PnL made by strategy. I've used to loop through AllTrades collection to count PnL made for current day, but I'd like to avoid using virtual trades to count only those that were really made.

    One question comes up immediately: say, if I disable and enable strategy throughout the day for few times, will the strategy include real trades that were made by it while counting the PnL when the strategy is enabled again (RealTime collection)? If not, is there a way to avoid counting virtual trades and just to count real ones (without saving realtime trades into file)?

    Thank you in advance.

    #2
    Hi RobertasJ, the Realtime trades collection is reset if you reenable the strategy, it would not 'housekeep' the value generated for the current session, but only include live generated trades since the last enablement, as this is done per started instance of the strategy.

    What you would unfortunately need to do here in your case is persisting / saving the prior realtime trades to a custom file and then appending those values with the newer realtime results generated after you've restarted the strategy.

    Comment


      #3
      I see, thank you for your reply.

      I've decided to play with GetAccountValue instead. And all seems well apart one thing: it gets value during "OnBarUpdate" methods, it gets "0" if I try to extract it's value during strategy initialization (be it OnStartUp or Initialize). Any suggestions on how can I extract initial account's balance once when the strategy is enabled?

      Comment


        #4
        This is likely returned as this call would be done then on historical data still, if you request it on the first realtime OnBarUpdate() bar it would be accessible (this would be the first possible access point).

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        646 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        367 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X