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 RubenCazorla, 08-30-2022, 06:36 AM
    3 responses
    77 views
    0 likes
    Last Post PaulMohn  
    Started by f.saeidi, Yesterday, 12:14 PM
    9 responses
    23 views
    0 likes
    Last Post f.saeidi  
    Started by Tim-c, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post Tim-c
    by Tim-c
     
    Started by FrancisMorro, Today, 03:24 AM
    0 responses
    4 views
    0 likes
    Last Post FrancisMorro  
    Started by Segwin, 05-07-2018, 02:15 PM
    10 responses
    1,772 views
    0 likes
    Last Post Leafcutter  
    Working...
    X