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 TomTownsend, Yesterday, 10:12 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by rdeste911, Today, 02:04 AM
            0 responses
            5 views
            0 likes
            Last Post rdeste911  
            Started by aligator, Yesterday, 04:32 PM
            1 response
            26 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by zacharydw00, Yesterday, 05:14 PM
            0 responses
            12 views
            0 likes
            Last Post zacharydw00  
            Started by shahabjet1, Yesterday, 04:47 PM
            0 responses
            24 views
            0 likes
            Last Post shahabjet1  
            Working...
            X