• 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

PnL for all strategies/instruments for a day (realized and unrealized)

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

    PnL for all strategies/instruments for a day (realized and unrealized)

    I want to start to run multiple instruments off a strategy. I would like to check the total balance of the realized and unrealized PnL so I can use the total PnL as a stop loss or a take profit signal to halt trading on all strategies and instruments. I can do it just fine on a single instrument but am looking for a snippet of code to look at the account balance rather than the position balance. Any help is appreciated.

    #2
    Hello cpabiz20k,

    Thank you for the post.

    I wanted to clarify, do you mean to gather the PnL for all instruments your strategy uses, or do you mean in a greater scope and literally all strategies you have running?

    If you mean just for this strategy, you could use the Position objects to gather unrealized PnL from any of the open positions it has. You can use the SystemPerformance collection for realized PnL. If you otherwise meant all of the account in total, this is something you would need to access an account directly and use the addon account methods for. https://ninjatrader.com/support/help...ount_class.htm

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

    Comment


      #3
      Thanks for the information. I am looking to find a way for all strategies to be considered. If I have 2 strategies running for the day, when the total daily value hits a certain value in profit or loss, I want to close out all strategies. Seems like there would be a snippet of code somewhere to help with that.

      The reason I am focusing on the account is that I can see the total daily value of all strategies that have been running for the day from the broker. Any additional help is appreciated.

      Comment


        #4
        Hello cpabiz20k,

        Thank you for your reply.

        Yes, in this case, there is not really an existing method specifically for this as this goes against how strategies normally operate. Strategies are generally intended to be isolated so accessing other strategies information is not native to a strategy.

        You could use the addon account methods to pull the overall account values in each strategy and then have each strategy manage its self based on that information.

        https://ninjatrader.com/support/help.../en-us/get.htm
        https://ninjatrader.com/support/help...ccountitem.htm
        https://ninjatrader.com/support/help...ount_class.htm

        If you are only looking for the values from strategies excluding manual trading you would need to have each strategy instance and its trade performance values. The addon account methods can loop over the strategies collection as well:

        https://ninjatrader.com/support/help...es_account.htm

        With each strategy instance, you could use its normal strategy account reporting methods to retrieve those strategies values.

        These would be a few options on how you could approach this.

        I look forward to being of further assistance.


        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by chartish, Today, 04:43 PM
        0 responses
        1 view
        0 likes
        Last Post chartish  
        Started by Trader17, Today, 04:07 PM
        0 responses
        1 view
        0 likes
        Last Post Trader17  
        Started by GussJ, Today, 01:30 PM
        2 responses
        16 views
        0 likes
        Last Post GussJ
        by GussJ
         
        Started by GARZONJ, Today, 12:25 PM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by RandanAL, Today, 11:53 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X