Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Status of an order?

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

    Status of an order?

    This is surely a FAQ, but I can't find the code. How do I tell if an order is active, current gain/loss, and if closed at a profit or loss? Say I have the code:

    SetStopLoss("MyStrat1", CalculationMode.Ticks, 4, false);
    SetProfitTarget("MyStrat1", CalculationMode.Ticks, 4);
    entryOrder = EnterLongLimit(0, true, 1, Close[0], "MyStrat1");

    Then, how can I tell if my order has been activated, how much current gain or loss I have on the active order, and if the order was closed out for a profit, or loss?

    Thanks again for your help.

    #2
    Hello timmbbo,

    Thanks for your post.

    You can use Position to see if you are in a Long, Short or Flat position. In the helpguide reference is an example that also prints the Unrealized PNL of the active order: https://ninjatrader.com/support/help...etposition.htm

    After the order has closed (IE: Position is Flat), you can access the trades performance. In the first example shown in the helpguide link you can see how to obtain the last trade value: https://ninjatrader.com/support/help...collection.htm

    There are other ways to do the same thing and a good reference with a wealth of information in working examples you can download, review, and test are the numerous references samples shown here: https://ninjatrader.com/support/foru...splay.php?f=30
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by BarzTrading, Today, 07:25 AM
    2 responses
    23 views
    1 like
    Last Post BarzTrading  
    Started by devatechnologies, 04-14-2024, 02:58 PM
    3 responses
    20 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by tkaboris, Today, 08:01 AM
    0 responses
    4 views
    0 likes
    Last Post tkaboris  
    Started by EB Worx, 04-04-2023, 02:34 AM
    7 responses
    163 views
    0 likes
    Last Post VFI26
    by VFI26
     
    Started by Mizzouman1, Today, 07:35 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X