Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Horizontal line programmatically

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

    Draw Horizontal line programmatically

    Hi,

    I would like to write an indicator which should draw a horizontal line (like ConstantLine indicator comes default with NT). But, we need to provide values to this ConstantLine indicator and has a limitation of accepting only 4 values.

    However, I would like to draw the horizontal lines on every Pshycological number (.00, 0.25, 0.50, 0.75). I tried to search the similar kind of indicator or the programming idea in this thread but with no success.

    Can someone tell me how to add new Plot dynamically using C# code? Your help would be very much appreciated.

    Thanks

    #2
    yameen.forex, the ConstantLine indicator would work via Plots and those could unfortunately not by dynamically added in - what you can look into is creating your study via regular lines dranw via DrawLine calls - http://www.ninjatrader.com/support/h...7/drawline.htm

    Comment


      #3
      Hi Bertrand,

      Thanks for your reply. I have seen the DrawLine() method in the documentation, but I need to display the constant lines regardless of these parameters (startBarsgo, StartY, etc..). I have been using this custom indicator on MetaTrader4 Platform, attached screenshot for reference.

      World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


      Any more ideas would be very much appreciated.

      Comment


        #4
        yameen.forex, thanks - if you do not wish to work with the DrawLine signatures to create those on the fly, you could alternatively look into complete custom plotting via an overriden Plot method as well - this would be then done purely via C# and unfortunately not much documented / supported by us. The CustomPlotExample and Pivots indicators installed per default with NT though could be used as starting point.

        For this type of study, I would just go with an amended Constant Lines indicator that would contain a higher # of plots. Since most the lines would not be viewed anyways in realtime going forward wih this study.

        Comment


          #5
          Originally posted by yameen.forex View Post
          Hi Bertrand,

          Thanks for your reply. I have seen the DrawLine() method in the documentation, but I need to display the constant lines regardless of these parameters (startBarsgo, StartY, etc..). I have been using this custom indicator on MetaTrader4 Platform, attached screenshot for reference.

          World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


          Any more ideas would be very much appreciated.
          Use a for loop in OnStartUp() to draw the lines if you want static lines. Use OnBarUpdate() if you want dynamic lines.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          581 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          338 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X