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

Problem with PositionAccount

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

    Problem with PositionAccount

    Hi

    I want to code for an indicator that shows how much time has passed since I put a trade. If 5 minutes or more have passed and the unrealized P&L is less than 5 ticks, I want an alert to be posted. The code seems to be okay but for a programming error which seems to have something to do with my use of "PositionAccount". I have checked the NT8 help guide on it and it seems I am using it correctly but for some reason I keep getting the programming error. Could you please have a look at my simple indicator which I have attached for your reference and could you enlighten me on how to use "PositionAccount" appropriately? I have tried my best with the scanty information provided in the help guide to no avail. Thanks.
    Attached Files

    #2
    Hello mbesha,

    There is not an object in NinjaTrader called PositionAccount. Is this an object or class that you have created? Was this created in a different file? (I'm not seeing that a class or variable named PositionAccount was declared in this strategy)

    Are you trying to check the position of the strategy?

    if (Position.MarketPosition == MarketPosition.Long)
    {
    // execute code
    }

    Below is a link to the help guide on Position.MarketPosition.
    http://ninjatrader.com/support/helpG...etposition.htm


    Also, below is a link to the section of the forums for NinjaTrader 8 related items.
    http://ninjatrader.com/support/forum...splay.php?f=59
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your prompt feedback. Well, according to the NT8 help guide, there is such an object. I have attached a screenshot from the helpguide website of the said object for your reference.
      I tried using "position" but I got the same error bdw.
      Attached Files

      Comment


        #4
        Hello mbesha,

        I am not able to see this screenshot.

        Was this attached as an attachment to your post? (and not as a picture)

        Can you provide a link to the page of the help guide you are referring to?

        Where you able to find the code you need from the link in the help guide that I have provided you in post #2.

        Did you make sure you used a capital P on Position as shown in the help guide link I have provided you?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, I did attach it as an attachment.

          Here is the link : http://ninjatrader.com/support/helpG...ionaccount.htm

          I did use a capital P.

          Comment


            #6
            Hi mbesha,

            Thank you for the link. (This was actually new to me)

            I've made a quick test script to test using the PositionAccount object and found that this compiles without issue.

            I took a second look at your strategy and found that this is not a strategy, this is an indicator.

            The Position and PositionAccount are not available to indicators. This script will need to be re-created as a strategy and not as an indicator.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              So that was the problem! Thanks for your prompt feedback and technical assistance.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,606 views
              0 likes
              Last Post aligator  
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              8 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              18 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              4 views
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              13 views
              0 likes
              Last Post Javierw.ok  
              Working...
              X