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 toughiee, Today, 12:04 AM
        0 responses
        3 views
        0 likes
        Last Post toughiee  
        Started by vdoan20, Yesterday, 08:30 PM
        0 responses
        8 views
        0 likes
        Last Post vdoan20
        by vdoan20
         
        Started by gupagoer, Yesterday, 07:42 PM
        0 responses
        9 views
        0 likes
        Last Post gupagoer  
        Started by Holligoly, Yesterday, 05:13 PM
        2 responses
        11 views
        0 likes
        Last Post Holligoly  
        Started by Raginpower, Yesterday, 01:53 PM
        0 responses
        14 views
        0 likes
        Last Post Raginpower  
        Working...
        X