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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X