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

If positition.. how many lots

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

    If positition.. how many lots

    Hi NT Team,

    How to do return the size of a position (if i have an active) in NinjaScript ?

    Thanks

    #2
    Hello akvevo,

    Thanks for opening the thread.

    You can return the the current position size of a strategy using the Quantity property from Position. For a multi series NinjaScript, you can use Positions, and for the overall account, you can use PositionAccount.

    Position.Quantity - http://ninjatrader.com/support/helpG...n_quantity.htm

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

    Comment


      #3
      Thanks Jim,

      What if I am not using a "strategy" ?

      I just want to apply an "indicator" to a symbol.. that returns the number of lots for an open position if there is one, else return 0.

      Is that possible ?

      My ultimate goal is to add a coloumn to my market analyser (an indiciator coloum) that = number of lots of open positions * margin >> just to tell me how much $$$ iam using for margin for that symbol.

      Comment


        #4
        Hello akvevo,

        Thanks for your reply.

        Position refers to the position of the strategy. This object as well as Positions and PositionAccount are only available in a strategy.

        You could come up with a solution by having a strategy read these values and store them to static variables of an AddOn and then have your Indicator read these values from the AddOn and then plot them.

        Here is an example of how you can share data between NinjaScripts: http://ninjatrader.com/support/forum...104#post457104
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jclose, Today, 09:37 PM
        0 responses
        5 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
        11 views
        0 likes
        Last Post firefoxforum12  
        Started by stafe, Today, 08:34 PM
        0 responses
        11 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