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 habeebft, Today, 07:27 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChristopherS  
    Started by AveryFlynn, Today, 04:57 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by Max238, Today, 01:28 AM
    4 responses
    37 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by r68cervera, Today, 05:29 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by geddyisodin, Today, 05:20 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X