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

Setting IsGlobalDrawingTool

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

    Setting IsGlobalDrawingTool

    Using the following code segment:

    NinjaTrader.NinjaScript.DrawingTools.Line lt = Draw.Line(this, "lineGlobexHigh", false,Times[(int)sessionsType.RTH][0], globexHigh, Times[(int)sessionsType.RTH][0].AddHours(6.5), globexHigh,
    GlobexHighColor , GlobexHighStyle, GlobexHighWidth, true);

    lt.IsGlobalDrawingTool = true;


    I get the following compile error:

    "Property or indexer 'NinjaTrader.NinjaScript.DrawingTools.DrawingTool. IsGlobalDrawingTool' cannot be assigned to -- it is read only"




    How do I set the IsGlobalDrawingTool property of the horizontal line? Please note that line creation code compiles without errors and code works as expected.


    A second question.

    A line created as follows:

    NinjaTrader.NinjaScript.DrawingTools.HorizontalLin e hzl = Draw.HorizontalLine(this,"hz",2900, Brushes.Azure);


    The horizontal lines does not have the 'IsGlobalDrawingTool' property.


    How do you set up a global horizontal line?


    Thank you for you help.
    Last edited by kweiss; 09-08-2019, 01:47 PM.

    #2
    Hello kweiss, thanks for your note.

    You should use this constructor to make the line global:

    Code:
    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY,[B] bool isGlobal[/B], string templateName)
    IsGlobalDrawingTool is read only, so there is a getter, but no setter.

    Please let me know if you have any additional questions.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I appreciate your quick reply. Please answer the second question:


      A line created as follows:

      NinjaTrader.NinjaScript.DrawingTools.HorizontalLin e hzl = Draw.HorizontalLine(this,"hz",2900, Brushes.Azure);


      The horizontal lines does not have the 'IsGlobalDrawingTool' property.


      How do you set up a global horizontal line?

      Thanks.

      Comment


        #4
        Hello kweiss,

        Thanks for your message.

        IsGlobalDrawingTool is read only and cannot be set programmatically. You will need to use an overload for Draw.HorizontalLine that allows creating Global Draw Objects.

        For example:

        Draw.HorizontalLine(NinjaScriptBase owner, string tag, double y, bool isGlobal, string templateName)
        Draw.HorizontalLine(this, "tag", Close[0], bool isGlobal, string templateName)

        You can reference documentation for Draw.HorizontalLine here - https://ninjatrader.com/support/help...zontalline.htm

        Please let us know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thank you for your explanation.

          Last edited by kweiss; 09-09-2019, 07:04 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          6 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