Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Market Position

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

    Market Position

    Is there a way if you are long 5 in one direction that you can put in a stipulation like:

    if (Positions[1].MarketPosition == 5)
    do something????

    #2
    Hello edgeliner,

    Thank you for your post.

    The method of using Positions[1].MarketPosition will return an enumeration which indicates position such as long or flat.

    In this case you would want to use Positions[1].Quantity instead. This will return the current position size rather then the market position.

    For information on Quantity please visit the following link: http://www.ninjatrader.com/support/h...7/quantity.htm
    Please let me know if I may be of further assistance.

    Comment


      #3
      Great Patrick! Just what I was looking for!! Thanks a bunch!!!!!

      Comment


        #4
        Originally posted by NinjaTrader_PatrickH View Post
        Hello edgeliner,

        Thank you for your post.

        The method of using Positions[1].MarketPosition will return an enumeration which indicates position such as long or flat.

        In this case you would want to use Positions[1].Quantity instead. This will return the current position size rather then the market position.

        For information on Quantity please visit the following link: http://www.ninjatrader.com/support/h...7/quantity.htm
        Please let me know if I may be of further assistance.
        Hello Patrick,

        as far I understand position object holds data related to a currently held position by a strategy (Strategy Position). How can I know the total position at market of the account (Account Position)?

        I mean position held by the strategy plus any other position by DOM or by other strategies working on the same instruments

        I would like to close all open positions at market (created by strategy but also by manual trading) without stopping the strategy itself so NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverythin g(); is not ok

        How can I do it by code?

        thank you very much
        Last edited by BMM73; 03-18-2018, 04:00 PM.

        Comment


          #5
          Hello BMM73,

          Thank you for your response.

          There is no supported solution to pull the account position in NinjaTrader 7.

          However, NinjaTrader 8 does provide such a solution through the PositionAccount object. You can find more details at the following link: https://ninjatrader.com/support/help...ionaccount.htm

          Please let me know if you have any questions.

          Comment


            #6
            Originally posted by NinjaTrader_PatrickH View Post
            Hello BMM73,

            There is no supported solution to pull the account position in NinjaTrader 7.
            Thanks for the reply

            It seems that I found a solution thanks to this unsupported procedure:

            Support for the development of custom automated trading strategies using NinjaScript.


            By the way I don't understand why to hide this kind of solutions, better to say "you can try this at your risk because it is an unsupported one"

            my 2 cents

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Aviram Y, Today, 05:29 AM
            0 responses
            1 view
            0 likes
            Last Post Aviram Y  
            Started by quantismo, 04-17-2024, 05:13 PM
            3 responses
            25 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by ScottWalsh, 04-16-2024, 04:29 PM
            7 responses
            34 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cls71, Today, 04:45 AM
            0 responses
            6 views
            0 likes
            Last Post cls71
            by cls71
             
            Started by mjairg, 07-20-2023, 11:57 PM
            3 responses
            216 views
            1 like
            Last Post PaulMohn  
            Working...
            X