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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    31 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, Yesterday, 02:41 AM
    0 responses
    14 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    22 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Working...
    X