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