Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code to have it look and total real time PnL on a account and...

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

    Code to have it look and total real time PnL on a account and...

    Hi:

    1. What code do I need to use to have a Strategy monitor a accounts total PnL (the sum of Total Realized Profit and Unrealized Profit across all instruments traded on a particular account during the day) and if it exceeds whatever amount I put in (i.e. "X" amount) then have it exit all positions and disable all strategies for that particular account?

    2. By the way...we are talking code for a regular Trading Strategy (NOT a ATM Strategy...you guys may want to consider changing the name of ATM Strategies in NT 8).

    3. Also, side question, are you doing Beta Testing with NT8 with regular customers yet? If so, I would like to be considered (let me know if there is a process to go through)...



    Thanks,

    Greg
    Last edited by birdog; 01-28-2013, 10:58 AM.

    #2
    Hello Greg,
    You can retrieve the Realized PnL using the GetAccoutValue method.

    Please refer to our help guide to know more about it


    To get the Unrealized PnL you can use the below code
    Position.GetProfitLoss


    However please do note, the GetProfitLoss will return the value of the unrealized PnL for the same strategy itself and not for other running strategies.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Joy,

      Ok...on the 1st one...Cash Value...how can I have it check the current day's total PnL during the trades (what I am looking for is if the current real time PnL between realized and unrealized "account wide" is below, say -$250.00 then...

      Also, what would I put in the "then or do something" statement to have it exit all positions of any instrument at all in the account and also (once totally flat) disable all strategies associated with the account?

      Comment


        #4
        Hello Greg,
        You may create a input variable and append the cash value manually at the start of the day to do it.

        To flatten your positions you can use the below unsupported code.
        Code:
        NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverything()
        However please do note that this will flatten ALL orders on ALL accounts associated with NinjaTrader.

        NinjaTrader 8 is not yet opened for Beta and I am not yet aware of any ETA.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          is that the same strategy itself running on multiple instruments in the Strategies tab to get the value or the same strategy for the individual instrument separately and independently?

          Comment


            #6
            Hello birdog,
            Can you please further clarify your query.

            What strategy you are referring to. What code you are specifying.

            I look forward to assisting you further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X