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 manueldecastro, Yesterday, 10:26 AM
              4 responses
              17 views
              0 likes
              Last Post manueldecastro  
              Started by TraderIqbal, 10-20-2023, 10:12 AM
              2 responses
              119 views
              0 likes
              Last Post Funnywo
              by Funnywo
               
              Started by Creamers, 04-27-2024, 05:32 AM
              12 responses
              72 views
              0 likes
              Last Post Creamers  
              Started by fredericlebre, Today, 01:19 AM
              0 responses
              8 views
              0 likes
              Last Post fredericlebre  
              Started by TraderJA, Today, 12:06 AM
              0 responses
              11 views
              0 likes
              Last Post TraderJA  
              Working...
              X