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

MarketPosition not returning the real information

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

    MarketPosition not returning the real information

    Hello Everyone,

    In my ninjascript on BarUpdate event I've been noticing that MarketPosition object is not showing real data, I enter the market long or short but when access properties like MarketPosition always shows me flat. If I look at the control center, positions tab, there it shows me real data, positioned long or short.

    I'm using Clear broker in Brazil.

    Has anyone faced something similar?

    Thank you
    Rodrigo

    #2
    Hello Rodrigo,

    May I see the line of code you are using?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Rodrigo,

      May I see the line of code you are using?
      sure, this is what I'm using to print to the output window, on every onbarupdate, even after I entered the market it shows me flat.

      Print(Position.MarketPosition.ToString());

      Thanks,

      Rodrigo

      Comment


        #4
        Hi rgaleote,

        May I have your complete script to test?

        To export your script do the following:
        1. Click File -> Utilities -> Export NinjaScript
        2. Enter a unique name for the file in the value for 'File name:'
        3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
        4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


        Below is a link to the help guide on Exporting NinjaScripts.
        http://www.ninjatrader.com/support/h...nt7/export.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Before I send you the script, could it be because I manually added another instrument on the code, and it's in that instrument that I'm getting positioned? If that is the case how could I access MarketPosition for that other instrument? (1) or something?

          Thank you

          Comment


            #6
            Hi rgaleote,

            Yes, that could be a possibility.

            If there are multiple data series, the position reflected will be the position of the currently processing BarsInProgress.

            To access the positions of a secondary series use:

            Positions[1].MarketPosition.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by SophieRogers
              These pills can be toxic even deadly well coming up on sign thing you
              Me thinks someone does not like that NinjaTrader opened its own brokerage and now they are into spamming NT.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by f.saeidi, Today, 11:02 AM
              1 response
              2 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by geotrades1, Today, 10:02 AM
              4 responses
              12 views
              0 likes
              Last Post geotrades1  
              Started by rajendrasubedi2023, Today, 09:50 AM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by lorem, Today, 09:18 AM
              2 responses
              11 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by geddyisodin, Today, 05:20 AM
              4 responses
              30 views
              0 likes
              Last Post geddyisodin  
              Working...
              X