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 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
    BertrandNinjaTrader Customer Service

    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.

      Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


      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.
        BertrandNinjaTrader Customer Service

        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.

          Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


          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 ChartTourist, Today, 08:22 AM
          0 responses
          4 views
          0 likes
          Last Post ChartTourist  
          Started by LiamTwine, Today, 08:10 AM
          0 responses
          2 views
          0 likes
          Last Post LiamTwine  
          Started by Balage0922, Today, 07:38 AM
          0 responses
          5 views
          0 likes
          Last Post Balage0922  
          Started by JoMoon2024, Today, 06:56 AM
          0 responses
          6 views
          0 likes
          Last Post JoMoon2024  
          Started by Haiasi, 04-25-2024, 06:53 PM
          2 responses
          19 views
          0 likes
          Last Post Massinisa  
          Working...
          X