Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Determining the outcome?

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

    Determining the outcome?


    Say I code:

    SetProfitTarget(8 ticks)
    SetStopLoss(8 ticks)
    .....
    EnterLong()

    How can I programmatically determine the outcome of this trade, if it gained or lost? Thanks


    Last edited by timmbbo; 11-10-2023, 12:35 AM.

    #2
    Hello timmbbo,

    Thank you for your post.

    You can calculate the PnL for the last completed real-time trade and determine if it is a win or a loss.

    For example,

    Code:
    Trade lastTrade = SystemPerformance.AllTrades[Count - 1];
    
    double lastProfitCurrency = lastTrade.ProfitCurrency;
    https://ninjatrader.com/support/help.../nt8/trade.htm

    Please let me know if you have any other questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    132 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X