Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Could I set money management seperately for multi-strategy on realtime-trade?

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

    Could I set money management seperately for multi-strategy on realtime-trade?

    Hi I am beginner of Ninja trader.
    Could I set money management seperately for multi-strategy on realtime-trade?

    strategy1:1000US dollar
    strategy2:1000US dollar
    strategy3:1000US dollar

    start entry
    strategy1 :entry long size = 1000/(current price);
    after times
    exit long:
    strategy1 :exit long and strategy1's money = cash + (entry long size)*(current price) ;

    and it can save the money to *.txt file (moneyTable.txt).
    And load the table for start the computer?

    Or there should be another money management for this condition?

    Thank you very much.

    #2
    Hello yungcross,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    You can develop these conditions directly in your strategies. If you need to write and read from a file you can use the example at the following link: http://www.ninjatrader.com/support/f...ead.php?t=3477

    Please let me know if I may be of further assistance.

    Comment


      #3
      Hi Patrick,

      Thank you for your reply.
      I have another question.
      Will ninjatrader save the strategy position after I close the ninjatrder
      or power off the PC?

      Or I should get the strategy position infomation from the Interactive broker
      After I power on the PC.

      And the same question for stop order.

      Could you give a liitle example for this.

      Thank you very much.

      Comment


        #4
        This is actually one of the key things to understand while using Ninjatrader. When you start the strategy, it calculates based on historical data till-date, what should have been the position. Only after this your real strategy starts executing live. You have multiple options here to choose to influence NT behavior.

        Explained in detail here:

        Comment


          #5
          Hello yungcross,

          Thank you for your response.

          If you shut down NinjaTrader the strategy will no longer be running as it is on your PC. The position it self will be on the broker's side so when you re-start NinjaTrader this should be reported by the broker to NinjaTrader via the API. However, the strategy will not be able to pick up any old orders or positions from the previous instance.

          The information StockFundoo provides is detailing the difference between a strategy position versus your account position. A strategy after being enabled may determine it's position should now be long, yet your account may currently be short for the same instrument.

          In addition, there are settings that will dictate how the strategy reacts to the account when re-enabled. You can find information on these settings at the following link: http://www.ninjatrader.com/support/h..._account_p.htm

          Please let me know if I may be of further assistance.

          Comment


            #6
            Hi Patrick,

            I have another question.
            Could I set the strategy's Position quantity = IB's quantity.
            I have tried "Position.Quantity=myPosition.Quantity;"
            But system will crash.

            I want to handle the strategy's quantity and MarketPosition on powering on the PC
            or restart the ninjatrder.
            Couly you give me some suggestions?

            Thank you very much.

            Comment


              #7
              Hello yungcross,

              Thank you for your response.

              You cannot set Position.Quantity, it is a property called for the Position. If you wish to access the account position you will need to use unsupported methods, such as the following:
              Code:
              foreach (Account acct in Cbi.Globals.Accounts)
              {
              if (acct.Positions != null)
              {
              PositionCollection positions = acct.Positions;
              foreach (Position pos in positions)
              {
              Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
              }
              }
              Unfortunately, this is not supported and there is no documentation on this item.

              Please let me know if I may be of further assistance.
              Last edited by NinjaTrader_PatrickH; 11-05-2013, 12:13 PM.

              Comment


                #8
                Hi Patrick,

                question1:
                So I shouldn't close ninjatrader overnight or shut down the pc.
                Should I always turn on the ninjatrader?

                question2:
                I know "Account acct in Cbi.Globals.Accounts" can get the info from IB.

                Is there a method that can modify the strategy's position quantity using the code?

                Thank you very much.

                Comment


                  #9
                  Hello yungcross,

                  Thank you for your response.

                  In the case of a brokerage connection that needs to disconnect over night, then you will need to disconnect and/or restart NinjaTrader.

                  I do not know of a method to force the strategy position quantity. If you pull the account position then you should be able to use your own internal calculations to sync the strategy to the account. You can use the Unmanaged Approach to submit orders to manage your account positions, but keep in mind the strategy position will then not reflect the true position and you will need to track your own performance.

                  For information on the Unmanaged Approach please visit the following link: http://www.ninjatrader.com/support/h...d_approach.htm

                  Please let me know if I may be of further assistance.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by MacDad, 02-25-2024, 11:48 PM
                  7 responses
                  158 views
                  0 likes
                  Last Post loganjarosz123  
                  Started by Belfortbucks, Today, 09:29 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post Belfortbucks  
                  Started by zstheorist, Today, 07:52 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post zstheorist  
                  Started by pmachiraju, 11-01-2023, 04:46 AM
                  8 responses
                  151 views
                  0 likes
                  Last Post rehmans
                  by rehmans
                   
                  Started by mattbsea, Today, 05:44 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post mattbsea  
                  Working...
                  X