• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code for "Flatten Everything" and Total/Overall Unrealized PnL

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

    Code for "Flatten Everything" and Total/Overall Unrealized PnL

    Hi NT8,

    What is the Ninjascript code to "Flatten Everything"

    Also, is there a Ninjascript code for If(Total/entire account Unrealized PnL is > $100).

    In short, as I place multiple trades, I am looking for a strategy to flatten everything after my entire account Unrealized PnL reaches a profit threshold.

    Thank you
    Last edited by Austiner87; 02-17-2020, 06:03 PM.

    #2
    Hello Austiner87,

    You can find some previous discussion about flattening from a strategy in the following link:
    https://ninjatrader.com/support/foru...om-my-strategy

    Generally you would need to either track your orders and then submit the appropriate close positions or cancel the open orders. You can also use the addon Flatten method as noted.

    For Unrealized PnL you can use the Position object and its GetUnrealizedProfitLoss method.

    https://ninjatrader.com/support/help...8/position.htm
    https://ninjatrader.com/support/help...profitloss.htm


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Fiocco, Today, 05:59 AM
    0 responses
    0 views
    0 likes
    Last Post Fiocco
    by Fiocco
     
    Started by Perceivedshift, Today, 05:17 AM
    0 responses
    5 views
    0 likes
    Last Post Perceivedshift  
    Started by herbertmack, Today, 03:19 AM
    0 responses
    5 views
    0 likes
    Last Post herbertmack  
    Started by b16_aln, Today, 03:11 AM
    1 response
    108 views
    0 likes
    Last Post b16_aln
    by b16_aln
     
    Started by Ashley_Mogg, Today, 12:31 AM
    0 responses
    3 views
    0 likes
    Last Post Ashley_Mogg  
    Working...
    X