Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stopping all strategies based on acct profit or loss

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

    Stopping all strategies based on acct profit or loss

    I have an automated strategy that I am running on multiple instruments at the same time. I have each strategy set to stop trading based on losing a pre-set amount in a day or attaining a pre-set profit for the day. Each strategy trades or stops based on it's own profit or loss. I would like to have a universal variable that I can use to stop all strategies once an account loses a certain percentage (or amount) for the day or similarly achieves a profit target for the day.
    Is there any way to implement something like this? I think it requires some kind of universal variable that can operate across multiple strategies in the same account running concurrently and so far I haven't found that or figured out how to do that.
    Do you have any guidance on this issue?
    Thanks
    DaveN

    #2
    Hello Daven,

    Thank you for your post.

    There is no supported way to do this.

    However, there is an unsupported method of accomplishing this. You would need to query the accounts which would then allow you to grab the account information from them and check for realized profit and such.
    http://www.ninjatrader.com/support/f...ad.php?t=55718

    Please note that as this is unsupported, there is no documentation on this subject
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      I am trading all strategies in the same account, but it appears from your response and the hint you provided that when an account query is performed it is relevant only to the instrument that the strategy is trading. In other words if I am running an ES strategy and a YM strategy, and I do an account query inside the ES strategy I will only get results valid for ES trades, and vice versa inside the YM strategy?
      Am I understanding your guidance?

      Comment


        #4
        Daven,

        It would be for the account, not the instrument. This will get you the account information and what its value are based on all trading with it.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by daven View Post
          I have an automated strategy that I am running on multiple instruments at the same time. I have each strategy set to stop trading based on losing a pre-set amount in a day or attaining a pre-set profit for the day. Each strategy trades or stops based on it's own profit or loss. I would like to have a universal variable that I can use to stop all strategies once an account loses a certain percentage (or amount) for the day or similarly achieves a profit target for the day.
          Is there any way to implement something like this? I think it requires some kind of universal variable that can operate across multiple strategies in the same account running concurrently and so far I haven't found that or figured out how to do that.
          Do you have any guidance on this issue?
          Thanks
          DaveN
          1. Use a bool variable to enable/disable issue of trading orders.
          2. Set such variable according to how much the account value has changed.
          3. Reset the bool on start of day, so as to enable trading.

          Code:
          double accountValue = GetAccountValue(AccountItem.CashValue);
          Last edited by koganam; 09-12-2014, 01:39 PM.

          Comment


            #6
            Okay, I think I have enough to get started, but I have one additional question. When I do the query is the value I get inclusive of open and closed positions or just closed?
            Thanks for your help.
            DaveN

            Comment


              #7
              Originally posted by daven View Post
              Okay, I think I have enough to get started, but I have one additional question. When I do the query is the value I get inclusive of open and closed positions or just closed?
              Thanks for your help.
              DaveN
              I am not really sure. We might have to wait until the market is open, so that we can run a test on a account in realtime. A lot of the account related stuff only works in realtime on actual accounts, so Market Replay does not really help in those cases.

              In fact, when I examine the accounts, "Replay101" is not even listed as having a cash value at all.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bmartz, 03-12-2024, 06:12 AM
              4 responses
              32 views
              0 likes
              Last Post bmartz
              by bmartz
               
              Started by Aviram Y, Today, 05:29 AM
              4 responses
              12 views
              0 likes
              Last Post Aviram Y  
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              28 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by gentlebenthebear, Today, 01:30 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cls71, Today, 04:45 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X