Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question on Total Profit Target

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

    Question on Total Profit Target

    Hi,

    I found some samples to set daily profit target. but I do not know how to set the total profit target for each trade for the strategy, for example:

    for current strategy running, I have 2 positions, one is long ES, another one is long CL. I want to close all 2 positions when the total real time profit of (1 ES + 1 CL) >= $500.

    Can anyone help me to code this?

    Thank you!

    #2
    Hello OceanBass,

    Thank you for writing in.

    You would be able to use the GetProfitLoss() method to obtain the unrealized PnL for your positions: https://ninjatrader.com/support/help...profitloss.htm

    As we've got two positions here, you'll want to use the Positions collection to access a specific position held by the strategy: https://ninjatrader.com/support/help...?positions.htm

    You can then add the result of the two to figure out what your total unrealized PnL is. If it meets the criteria specified, then exit your positions.

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    85 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    47 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    29 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    67 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X