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 algospoke, 04-17-2024, 06:40 PM
    5 responses
    46 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by arvidvanstaey, Today, 02:19 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by mmckinnm, Today, 01:34 PM
    3 responses
    5 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by f.saeidi, Today, 01:32 PM
    2 responses
    8 views
    0 likes
    Last Post f.saeidi  
    Started by alifarahani, 04-19-2024, 09:40 AM
    9 responses
    55 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X