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

Draw.Line() Global doesn´t works

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

    Draw.Line() Global doesn´t works


    Hi team,
    I am trying to draw a line from my indicator script and I want to this line be global, so I can see the line in the ES chart for candle or ticks, but it doesn{t works.
    I use the following code to draw the lines:
    PHP Code:
    Draw.Line(this,lineNameBefore+"2",truebasrAgo,barsAgoY,0,barsAgoY,""); 
    the results is in the screenshots.
    What I am doing wrong? the global only works with the same type of charts?

    Thanks in advance.

    Attached Files

    #2
    Hello Nutriax,

    Thanks for your post.

    A global draw object will appear on all charts of the same instrument (unless "show global draw objects" is specifically excluded in the Data series settings)

    In order to draw a global line you would need to use the Draw.Line() method overload that uses the bool IsGlobal. The one that fits what you have posted would be:

    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)

    Reference: https://ninjatrader.com/support/help...?draw_line.htm

    I will move this thread to the NinjaTrader8 indicators forum.
    Paul H.NinjaTrader Customer Service

    Comment


      #3

      Hello, thank you for your quick response on this.
      I already checked and I have enable the "show global draw objects" in the data series of the ticks chart, but it is not displaying the lines.
      Also I used the same reference that you sent and the lines are drawed in the original chart (which has the indicator) but not in other ones, as I show you in the previous screenshot.)
      What else can I try?

      Thank you for your help on this.

      Attached Files

      Comment


        #4
        Hello Nutriax,

        Are you using the Drawing method overload that allows specifying isGlobal like Paul suggests?

        When I test the method overload Paul suggests, I see the global drawing object on other charts of the same instrument.

        Please see the attached script and screenshot for a working example.
        Attached Files
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello Jim/Paul,
          Thank you very much for your support on this, its working now! I had a problem at my side and I was able to figure it out when I review the example code that you posted Jim.

          I really appreciate! thanks a lot!

          Comment


            #6
            If i want to change the color and the size line, Is it posible using global drawing object ?

            Comment


              #7
              Originally posted by faroka View Post
              If i want to change the color and the size line, Is it posible using global drawing object ?
              Hello faroka,

              Thank you for your note.

              Although it is expected that a NinjaScript change of a global drawing object would not take effect on all charts, I recommend reviewing the sample provided in the following forum post:
              I've got a drawing tool that makes price changes via right-click context-menu items. I've attached a stripped down example with two menu items that Increases/decreases the prices on the drawing object by 4 points. When the drawing object is a Global Drawing object, the objects on the other charts are not updated. I'm sure


              My colleague Jim created that sample that demonstrates how to loop through all windows. It then takes all windows that are charts and loops through the ChartObjects to look for a DrawingTool, then finally it checks if the object is a Global DrawingTool. Then you may update all instances of the global DrawingTool - this approach would allow you to change the color and size of the global drawing objects.

              ​Please let us know if we may be of further assistance.
              Emily C.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,265 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              11 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X