• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Referencing position profit or loss within an indicator

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

    Referencing position profit or loss within an indicator

    This one has me stumped.

    I am trading live using the ATM in the DOM ladder. I don't always have an ATM strategy going, instead setting my entries and exits manually. I want to be alerted (either audibly or by drawing an object on the chart) when a certain condition occurs while a position is open.

    For example, say I have an indicator that alerts me whenever three price bars in a row have 3 equal highs. Now suppose I want the indicator to alert me only if 3 equal highs occur during a profitable open position.

    How would I do this? I see methods like GetAtmStrategyMarketPosition() but they require a position ID, which I don't know how to obtain. Another method AvgProfit() seem to take into account past positions, not just the open ones. OnPositionUpdate() requires a strategy, not an indicator. So does the Positions object.

    How would I obtain the current open position's running profit or loss within an indicator, not a strategy? The DOM window is able to display this value, so how would I access it from an indicator? For all open positions as well as individual open positions?

    -A

    #2
    anachronist,

    Unfortunately there is no supported way to grab discretionary trades from NinjaScript. Automated and manual trading are separate, and each strategy is separate from one another. This would be possible using a single automated strategy that trades itself however.

    Please let me know if I may assist further.
    Last edited by NinjaTrader_AdamP; 02-06-2012, 08:56 AM.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      AdamP, thank you for the reply.

      I have a number of situations where I'd want an indicator to show me something only when a position is open.

      May I suggest: In support of those customers who use NinjaTrader for discretionary live trading with the help of indicators, please expose the methods that appear to be already available (used by your DOM window code and elsewhere) to allow an indicator to access the current open position profit for an instrument.

      Thanks.
      -Alex

      Comment


        #4
        anachronist,

        I will suggest this to our developers and get you a tracking ID for the suggestion.

        Please let me know if I may assist further.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          anachronist,

          Your suggestion has ID #294

          Please let me know if I may assist further.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            I backup this request.

            Comment


              #7
              SARdynamite,

              I have added your vote to the tracking ID.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                i would like to third this request please

                Comment


                  #9
                  years have past and this request is still pending? lots of people have showed interest in this indicator. i understand this isn't supported, but with all the briliant programers in your team, one should be able to put this together

                  Comment


                    #10
                    Hello calhawk01,

                    Thanks for your post.

                    Your feedback will be taken into consideration. Any changes are being taken into consideration for NinjaTrader 8/ This has been developments main focus.
                    BrandonNinjaTrader Customer Service

                    Comment


                      #11
                      Quite similar, I Need to get Access to the average open Price of the Position object. If it cannot be done in an indicator, can I write a strategy to check for open Position and visualise some Price Levels on the Chart depending on the avg open Price of the Position, or will the strategy Close a Position that had been manually opened?

                      Thanks,
                      Martin

                      Comment


                        #12
                        Hello Martin,

                        Thank you for your response.

                        The Strategy will only pull performance of it's own position, the indicator cannot though. There are unsupported means to pulling account information.
                        Patrick H.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi Patrick,

                          would you mind to send a code snippet how to read Overall Position size and avg entry Price of an Instrument, even that this is not supported. It would really help me a lot!
                          I Need to write an indicator to visualise Exit Levels of an open Position where I can scale into over time that the indicator will update accordingly.

                          Thanks,
                          Martin

                          Comment


                            #14
                            Hello mstreck,

                            Below is a snippet for pulling account information such as positions:
                            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);
                            }
                            }
                            Patrick H.NinjaTrader Customer Service

                            Comment


                              #15
                              That is awesome. Thank you, exactly what I need.

                              Cheers,
                              Martin

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sergey_z, Today, 02:56 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by samir, Today, 02:46 PM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by neoikon, Today, 02:24 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by XimoTrader, Today, 12:57 PM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_PatrickG  
                              Started by FxInception, Today, 12:27 PM
                              2 responses
                              14 views
                              0 likes
                              Last Post FxInception  
                              Working...
                              X