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

Line Properties

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

    Line Properties

    The indicator I’m coding uses bars to calculate on a 45 min chart, but my trading chart is 1000 tick. If my code draws a horizontal line on the 45 min chart, the properties window of the line does not give me the option to print on All Charts, options in the little window are greyed out. I need to show this line on my trading chart. Is there any way to fix this?
    Thanks

    #2
    Hello Pete77,
    Unfortunately you can not draw Global Drawing Objects from within NinjaScript. To have a drawing object appear on all charts for that instrument they must be drawn manually.

    Please let us know if we can be of any other assistance.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the help. I would like to ask the question in another way:

      If I obtain a value (say a y value), in an indicator in one chart, can I somehow refer to this value in an indicator in a second chart?

      Pete

      Comment


        #4
        Hello,
        This would be possible through using the StreamWriter and StreamReader. The concept here would be you would get the value in indicator 1 and write the value to a file using StreamWriter and then in Indicator 2 read the value using StreamReader. Please see the following refence sample on StreamWriter: http://ninjatrader.com/support/forum...ead.php?t=3475
        Please see the following reference sample on using StreamReader: http://ninjatrader.com/support/forum...ead.php?t=3476
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          draw.line has isGlobal

          Cody, why that would not work for Pete?

          tnx,

          atata

          "isGlobal
          Determines if the draw object will be global across all charts which match the instrument"

          Comment


            #6
            Hello Pete and atata,

            NinjaTrader_CodyB is correct here in that sharing information between indicators can be achieved by writing to and reading from a file.

            Indicators and strategies have a separation. An instance of an indicator cannot communicate with another running instance of an indicator directly.

            However, an undocumented way of passing information between scripts in NinjaTrader 7 is to use a static variable or class in a custom namespace or within the Indicator namespace or Strategy namespace.
            This was not supported or documented with NinjaTrader 7 because using this will prevent a script from exporting. Also, any static variables cannot be optimized over in the Strategy Analyzer.

            Some information can be found about this in the threads below.
            https://ninjatrader.com/support/foru...ad.php?t=72638
            http://ninjatrader.com/support/forum...ad.php?t=10503
            http://ninjatrader.com/support/forum/showthread.php?t=4230Z
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Would you be so kind to answer my question?

              What this really means?

              draw.line

              "isGlobal
              Determines if the draw object will be global across all charts which match the instrument"

              Comment


                #8
                Hello atata,

                The .lsGlobal property of a drawing object that when true lets you know if this object will appear on all charts with the same instrument.

                In NinjaTrader 7, it is not possible to draw an object as a global object, however, this is possible with NinjaTrader 8 when drawing a new drawing object.
                After the object is drawn in NinjaTrader 8, it is no longer possible to set the object to global.

                To understand how a global drawing object works, try opening two charts with the same instrument. Then manually draw a dot or another object on one of the charts. Next, right-click the drawing object and select Properties... In the properties set the 'Apply to' to 'All Charts' in NT7, or in NT8 set 'Attach to' to 'All charts', then click OK.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by futurenets View Post
                  I created a new indicator called myCustomMethods and replaced the contents with

                  namespace NinjaTrader.Indicator
                  {
                  partial class Indicator
                  {
                  public static int myInt = 1000;
                  }
                  }
                  Can someone explain how to call "myInt" in another indicator?

                  Comment


                    #10
                    The code snippet in the previous quote does compile, but does not after compiling show up in the indicator list on a chart. Is this locked in some way or because it is lacking in some necessary stuff?

                    Comment


                      #11
                      To continue I know now what I have been trying to do (one chart getting a value from another) is not possible. Scott Daggett, author of NinjaScript Programmers Launch Pad was kind enough to point out that my problem can be solved by the fact that ninjaScript supports multi-time frame and instruments in a single script.

                      So I am off to see if I can learn how to do that.

                      Comment


                        #12
                        Hello Pete77,

                        I am not aware of a way to make an indicator itself static.

                        However, using undocumented methods you could create a static class or variable within the scope of the NinjaTrader.Indicator namespace.

                        Also, to add a secondary series to your script use the Add() method.

                        Below is a link to the help guide on the Add() method.
                        http://www.ninjatrader.com/support/h...s/nt7/add3.htm

                        A link to the help guide on BarsInProgress.
                        http://www.ninjatrader.com/support/h...inprogress.htm

                        And a link to the help guide on Multi-Time Frame & Instruments. Please see the section 'How Bar Data is Referenced', and 'Accessing the Price Data in a Multi-Bars NinjaScript'.
                        http://www.ninjatrader.com/support/h...nstruments.htm
                        Chelsea B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by andrewtrades, Today, 04:57 PM
                        0 responses
                        3 views
                        0 likes
                        Last Post andrewtrades  
                        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
                        6 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