• 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

Daily Account P/L

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

    Daily Account P/L

    So i want a strategy to cancel all open orders, when my account hits a certain Daily dollar loss. Is there a method to get the value of dollar loss for just the day? (including both realized and unrealized loss).

    #2
    Hello vidulk,

    Welcome to the NinjaTrader support forum.

    In contrast to the strategies virtual performance, you can use the SystemPerformance and TradesPerformance collections to do various tasks:

    https://ninjatrader.com/support/help...ancevalues.htm
    https://ninjatrader.com/support/help...erformance.htm

    We have some additional samples for strategies including tracking performance from a strategy here: https://ninjatrader.com/support/help.../strategy2.htm

    The sample "Using trade performance statistics for money management" includes daily reset logic.

    To access unrealized PnL for a position, you can use GetUnrealizedProfitLoss(): https://ninjatrader.com/support/help...profitloss.htm


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

    Comment


      #3
      So in order to use IsFirstBarOfSession to calculate values just for a given day, I would have to insert the strategy on an intraday chart with only the candles for the last day?

      Also I am trying to use this:
      https://ninjatrader.com/support/foru...78&postcount=2

      To cancel order over all accounts but im guessing that was written fro ninjatrader 7 as the editor is giving me the error of : the type or namespace name 'Globals' does not exist in the namespace 'NinjaTrader.cbi'.

      Any help on this?

      Comment


        #4
        Hello vidulk,

        Thank you for the post.

        To use IsFirstBarOfSession, you would need to use a series that has at least one bar that is the first bar of the session. Using an intraday chart would work for that purpose. The amount of data would not matter so much, mainly that intraday chart would need to include the first bar of the session for this to become true.

        Regarding the NT7 syntax, that would not work in NT8 quite a lot has changed between versions. To access the account directly, I would suggest reviewing the addon section of the NT8 help guide:
        https://ninjatrader.com/support/help...t_overview.htm
        https://ninjatrader.com/support/help...ount_class.htm

        Working with the account is considered an advanced programming task so I would suggest reviewing the help guide samples before working with the account directly. You would likely want to use either CancelAllOrders() or Flatten() to close all open orders or positions on the account.

        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Gregorian, Today, 02:05 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by smf2005, Today, 01:49 PM
        4 responses
        16 views
        0 likes
        Last Post smf2005
        by smf2005
         
        Started by punkiy2111, Today, 02:00 PM
        2 responses
        4 views
        0 likes
        Last Post punkiy2111  
        Started by hunter7, Today, 12:44 PM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by aaadetos, Today, 12:29 PM
        2 responses
        6 views
        0 likes
        Last Post aaadetos  
        Working...
        X