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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X