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 usazencort, Today, 01:16 AM
    0 responses
    1 view
    0 likes
    Last Post usazencort  
    Started by kaywai, 09-01-2023, 08:44 PM
    5 responses
    603 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    6 responses
    22 views
    0 likes
    Last Post xiinteractive  
    Started by Pattontje, Yesterday, 02:10 PM
    2 responses
    21 views
    0 likes
    Last Post Pattontje  
    Started by flybuzz, 04-21-2024, 04:07 PM
    17 responses
    230 views
    0 likes
    Last Post TradingLoss  
    Working...
    X