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

Printing the position

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

    Printing the position

    Hi!
    I just want to add a text in a chart showing the position.
    i tried with:
    Print(Position.MarketPosition), but it doesnt' work.
    I already know how to add text to a chart: just need the code to get the position.
    Thanks!

    #2
    Well, the Print() command will only print to the Output Window.

    If you know how to add text to the chart, use this for the print instead.

    Code:
    Position.MarketPosition.ToString()
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      I am getting an error while compliling.
      Sure I can use this command also for indicators?
      Thanks!

      Comment


        #4
        Can you post your code?
        mrlogik
        NinjaTrader Ecosystem Vendor - Purelogik Trading

        Comment


          #5
          Originally posted by mrlogik View Post
          Can you post your code?
          Please find attached the code and the error message.
          thanks!
          Attached Files

          Comment


            #6
            eswap0,

            Please add the .ToString() as shown in mrlogik's post earlier. You need to have this for it to print.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              eswap0,

              Please add the .ToString() as shown in mrlogik's post earlier. You need to have this for it to print.
              Thanks Josh,

              I undrestood .ToString() was needed only if i wanted to print it in the chart: as a first step, Output window is enought for me.
              Please check again attached file: similar error...
              Thanks!
              Attached Files

              Comment


                #8
                eswap0,

                You need to add .ToString() regardless if it is on a chart or in the Output Window. The Print() function only prints to the Output Window.

                I cannot understand your errors. You will need to translate them into English. But for one thing, Position.MarketPosition cannot be used from an Indicator. There is no concept of a position from an indicator because an indicator never trades.

                The errors in orange are errors in your other files. You need to double click them to bring up your other files and address those errors as well.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  As I posted previously, I was afraid it was not going to work in an indicator...
                  Any other way to print the current position without using strategies?
                  I use to have multiple charts open in my screen with different instruments and I would like to quickly see which I am in (short or long) and which I am not.
                  Thanks!

                  Comment


                    #10
                    No, there is no concept of positions from an indicator. If you just want to see position, can you not open up Chart Trader?
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Josh View Post
                      No, there is no concept of positions from an indicator. If you just want to see position, can you not open up Chart Trader?
                      Yes, this could work, although I already posted my problem here with Chart Trader.
                      I would prefer to add via ninjascript a small coloured sign near a border.
                      Bad luck.
                      Thanks anyway!

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by andrewtrades, Today, 04:57 PM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by chbruno, Today, 04:10 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post chbruno
                      by chbruno
                       
                      Started by josh18955, 03-25-2023, 11:16 AM
                      6 responses
                      436 views
                      0 likes
                      Last Post Delerium  
                      Started by FAQtrader, Today, 03:35 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post FAQtrader  
                      Started by rocketman7, Today, 09:41 AM
                      5 responses
                      19 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Working...
                      X