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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        23 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        33 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X