Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsInProgress use out of OnBarUpdate

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

    BarsInProgress use out of OnBarUpdate

    how can i use GetProfitLoss() for a position on Bars[1] when calling GetProfitLoss() from a timer tick event and not from OBU()?

    same goes for all other methods that are usually being called from OBU() like MarketPosition() and so on...

    #2
    savekad, what you pass in as price would be used as 'current price' for the PnL calculations - you would just need to be aware that the price would be represented by the last updates state of the bars object in OnBarUpdate().

    Comment


      #3
      but how do i know what position it calculates PL for if i have two positions for two instruments on the same strategy script?

      Comment


        #4
        For this purpose please try working with Positions[index].GetProfitLoss().

        Comment

        Latest Posts

        Collapse

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