Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

P&L for 2nd trade with 2 active

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

    P&L for 2nd trade with 2 active

    I am using :Position.GetUnrealizedProfitLoss(PerformanceUnit. Pips, Close[0]) >= Target to determine the P&L when there is 1 trade active and it seems to be performing correctly. There are times when I have 2 trades active and I require the P&L for the 2nd trade only and then there are times that I need the P&L for the two trades combined. Can someone tell me what to use in these two situations?

    #2
    Hi galsermil, thanks for posting. The Position object will be the average position. You would need code in your script that will save the entry prices to class level variables so it can be compared to the current price. Take the difference of those two numbers to find your profit/loss of individual trades.

    Kind regards,
    -ChrisL

    Comment


      #3
      Chris, will you tell me what I can reliably use for an opening price. I tried to use Close[0] and I wasn't even close.

      Comment


        #4
        Hi galsermil, the best way to save the execution price is in OnExecutionUpdate. This holds the exact execution price of the order in the "price" parameter.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X