Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

URGL from positions tab

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

    URGL from positions tab

    I have tried the following but it prints the URGL from strategies tab (historical), not the actual current position URGL from positions tab. I am looking for a function to get the actual current unrealized p&l from the positions tab. Thanks.

    if (!Historical && Position.MarketPosition != MarketPosition.Flat)

    {
    Print("Open PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Points));

    }

    #2
    Hello EthanHunt,

    Thank you for your post.

    There is no means to pull the Unrealized PnL of account's position from the Positions tab.
    You could use the following but the Close[0] (being the instrument the strategy is enabled on) would need to be instrument that the position is open for:

    This is unsupported code:
    Code:
    			foreach (Account acct in Cbi.Globals.Accounts)
    			{
    				if (acct.Positions != null)
    				{
    					PositionCollection positions = acct.Positions;
    					foreach (Position pos in positions)
    					{
    						Print(pos.GetProfitLoss(Close[0], PerformanceUnit.Currency));
    					}
    				}
    			}

    Comment


      #3
      I am just looking for the instrument position URGL, not the account URGL. Thanks.

      Comment


        #4
        Hello EthanHunt,

        Thank you for your patience.

        What do you refer to as the URGL?

        Position.GetProfitLoss would be the Unrealized Profit and Loss of the current position for the strategy.

        Comment


          #5
          I am looking for the actual position URGL. This seems to be different in the "positions" tab and "strategies" tab. The Positions tab seems to reflect actual URGL while the Strategies tab seems to reflect historical as if you'd been in the position from the beginning of the latest signal. So if I start a strategy there is an existing signal with URGL reflected in strategies tab but when it syncs, my actual position starts. When I print Position.GetProfitLoss it prints the amounts that match the Strategies tab URGL (historical as if been in position from the beginning).

          Comment


            #6
            Hello EthanHunt,

            Thank you for your response.

            There is no means around this. The GetProfitLoss will pull the strategy's position PnL which includes that of any historical positions that are open currently. The strategy and account position PnL would not be the same at the moment a historical position of the strategy is opened on the account as the entry points would likely be different.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X