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

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 rayyyu12, Today, 12:47 AM
            0 responses
            2 views
            0 likes
            Last Post rayyyu12  
            Started by ETFVoyageur, 05-07-2024, 07:05 PM
            17 responses
            133 views
            0 likes
            Last Post ETFVoyageur  
            Started by ETFVoyageur, Yesterday, 10:13 PM
            1 response
            8 views
            0 likes
            Last Post ETFVoyageur  
            Started by somethingcomplex, Yesterday, 10:36 PM
            0 responses
            9 views
            0 likes
            Last Post somethingcomplex  
            Started by sofortune, 05-10-2024, 10:28 AM
            5 responses
            22 views
            0 likes
            Last Post sofortune  
            Working...
            X