Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get Line Properties as input for indicator

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

    Get Line Properties as input for indicator

    I am developing an indicator to draw custom lines based on some condition. To draw the line , I want to get below properties from user. Do I need to get all one by one or is there any input type called Line available to collect all as group ? Kindly share your input.

    Color
    Width
    DashStyle
    Opacity

    #2
    Hello nandhumca,

    Thanks for your post.

    You could use a Stroke property as input to accomplish your goal. The Stroke class is used to characterize how a plot is visually displayed (plotted) on a chart.

    See this help guide page for more information about the Stroke class: https://ninjatrader.com/support/help...roke_class.htm

    More examples of using the Stroke class could be found in this help guide page: https://ninjatrader.com/support/help...8/?addplot.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Thanks I will define a parameter with type Stroke and explore.

      Comment


        #4
        Hi Brandon,

        I tried with below code to get line properties via Stroke. It is not showing option to select any. Do you have any sample code to use Stoke as input for indicator to draw lines ?

        [NinjaScriptProperty]
        [Display(Name="LineProp", Order=7, GroupName="Line")]
        public Stroke LineProp { get; set; }

        Comment


          #5
          Hello nandhumca,

          Did you set a default value so the stroke is not null? In SetDefaults you would need:
          Code:
          LineProp = new Stroke();
          Let us know if we may assist further.

          Comment


            #6
            Thanks Brandon. Now I am able to get the dashStyle, Brush and width from Stroke (LineProp). How to get the value of Opacity ? I am using Stroke value something like below

            Draw.Line(this, "LineGT1"+CurrentBar, true, 1, Close[1], -5, Close[1], LineProp.Brush, LineProp.DashStyleHelper, (int)LineProp.Width);
            Last edited by nandhumca; 08-27-2021, 03:14 PM.

            Comment


              #7
              Hello nandhumca,

              For the property you made it would be:

              Code:
              LineProp.Opacity
              Let us know if we may assist further.

              Comment


                #8
                Hi ,
                I tried above method.
                But the changes in the user input is not updated in the chart.

                I am using the user input "Stroke" in Addplot.
                Last edited by nobody31985; 02-19-2022, 11:50 PM.

                Comment


                  #9
                  Hello nobody31985,

                  For a Plot you would generally use a Brush input. I would suggest to try making a Brush input and then utilize that. If you still see a problem please open a new post for your individual question.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  637 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  366 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  107 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  569 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  571 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X