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

Plot Price Marker but not Plot

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

    Plot Price Marker but not Plot

    Hi,

    is there a way to plot a price marker on the chart, but without any (visible) plot?

    Basically I want to draw a short horizontal line and have the price marker at that level.

    I have tried setting plot pens to transparent, but the pricemarker then also becomes present.

    Could there be a way to set the pricemarker colour independently of the plot colour, or create some plot that has no visible line?

    Any suggestions welcome,

    thanks,
    Will.

    #2
    Hi Will unfortunately this would not be possible to separate the marker color from the plot. We have an enhancement suggestion in this regard in our trackings and I will make sure to note your request here as well. I would probably look into expressing the line over the plot directly so you would have the line and price marker as desired together. Another approach could be creating a custom marker via custom C# drawing in an overridden Plot method, you can review the Pivot indicator for examples into this (undocumented / supported) territory.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      This can be easily done. All you need to do is to add an empty custom plot to your indicator. The price markers will be shown, but the plot will not plot anything.

      Here is the code to add in the end of your indicator:

      Code:
      #region Miscellaneous
      
      public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
      {
          if (Bars == null || ChartControl == null)
              return;
      }
      #endregion

      Comment


        #4
        Hi,

        could you explain better what you mean by " I would probably look into expressing the line over the plot directly so you would have the line and price marker as desired together"?

        Are you suggesting that I plot my line over the top of the chart plot? If so, how would I get my chart plot to be a single straight line of fixed length?

        Thanks,

        Comment


          #5
          Hi Harry thanks for the idea. The plot override works, but now I am having trouble drawing my line. Would I still just do that as I would normally, in OnBarUpdate() using DrawLine()?

          Thanks,

          Comment


            #6
            Thanks for the input Harry, this actually this is a better idea for dontpanic's scneario. As long as you also set a plot value for the marker and using the DrawLine in OBU() think it should be what you seek? Do you get any errors returned trying to draw the line now?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Hi Harry, got my line now, so that idea seems to do the trick,

              thanks!

              Comment


                #8
                Hi,

                I only have the skeleton of my indicator so far, I just wanted to test the ideas, but using Harry's suggestion I am setting pen colour and other attributes and also using Plot.set() to set the price marker value, and then I use Drawline() at my own value from within OnBarUpdate(), and so I have my price marker and my line now, and no plot, the way I want it.

                Thanks again,
                will.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by RideMe, 04-07-2024, 04:54 PM
                5 responses
                28 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by f.saeidi, Today, 08:13 AM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by DavidHP, Today, 07:56 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by kujista, Today, 06:23 AM
                3 responses
                9 views
                0 likes
                Last Post kujista
                by kujista
                 
                Started by Mindset, Yesterday, 02:04 AM
                2 responses
                18 views
                0 likes
                Last Post NinjaTrader_RyanS  
                Working...
                X