Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

get Account position from within Strategy

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

    get Account position from within Strategy

    Hi,

    Is there a function to get Account position from within Strategy? I know there is Position.Quantity, but that is the quantity for this particular strategy.

    I 'd like the Strategy be aware of total number of, say EMini, contracts the account already holds, stopping add more if total contracts resulted from other running strategy has exceeded certain limit.

    Thanks.

    #2
    Hello Tony345,

    Thank you for your post.

    This kind of programming is not supported with NinjaTrader and we do not have any documentation on the subject.

    However, you can take a look at the options available for using your strategy and sync account position from the link below -
    http://www.ninjatrader.com/support/h..._positions.htm
    http://www.ninjatrader.com/support/h..._account_p.htm
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by Tony345 View Post
      Hi,

      Is there a function to get Account position from within Strategy? I know there is Position.Quantity, but that is the quantity for this particular strategy.

      I 'd like the Strategy be aware of total number of, say EMini, contracts the account already holds, stopping add more if total contracts resulted from other running strategy has exceeded certain limit.

      Thanks.
      ref: http://www.ninjatrader.com/support/f...ad.php?t=55718

      Comment


        #4
        Can I write/read an outside file from Strategy

        Hi,

        Following up on the original objective, can I write/read an outside file from Strategy? I am running multiple strategies on same instrument. Don't want to be over some limit.

        Thanks

        Comment


          #5
          Hi koganam,

          That works nicely. Thank you!

          tony345

          Comment


            #6
            Getting ACCOUNT position

            If you are like me and simply want the account position - I have the solution.

            If(Position.Account.Positions.Count == 0)


            will test for any instrument position... be aware...

            1 contract Long ES = 1
            2 contracts long ES = 1

            1 contract long ES && 4 contracts long NQ = 2.

            The function counts the number of different instruments that are present in the account. A short position equals 1 as well. NOT -1.

            If you are running a multi instrument strategy then use this code smippet:

            if (BarsInProgress == i
            && Positions[i].Account.Positions.Count > 0)

            do something:

            Could have done with this six months ago... regards to all.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jclose, Today, 09:37 PM
            0 responses
            4 views
            0 likes
            Last Post jclose
            by jclose
             
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            10 responses
            1,413 views
            0 likes
            Last Post Traderontheroad  
            Started by firefoxforum12, Today, 08:53 PM
            0 responses
            10 views
            0 likes
            Last Post firefoxforum12  
            Started by stafe, Today, 08:34 PM
            0 responses
            10 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by sastrades, 01-31-2024, 10:19 PM
            11 responses
            169 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X