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 r68cervera, Today, 05:29 AM
    0 responses
    2 views
    0 likes
    Last Post r68cervera  
    Started by geddyisodin, Today, 05:20 AM
    0 responses
    3 views
    0 likes
    Last Post geddyisodin  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    6 responses
    33 views
    0 likes
    Last Post JonesJoker  
    Started by GussJ, 03-04-2020, 03:11 PM
    12 responses
    3,239 views
    0 likes
    Last Post Leafcutter  
    Started by AveryFlynn, Today, 04:57 AM
    0 responses
    6 views
    0 likes
    Last Post AveryFlynn  
    Working...
    X