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/fill area at the top/bottom of the chart

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

    Draw/fill area at the top/bottom of the chart

    Hi,

    I'm trying to fill the area between a series and the bottom of the chart. In NT7 there was a CustomPlotSample indicator with example how to do draw from the chart's bounds. In NT8 there is a SampleCustomRender indicator but not the same example as before. I wish not to have to delve into SharpDX for a simple operation like that. I would just like to use Draw.Region to fill the area between a series and a Y value, the Y being the bottom of the chart. How to obtain the bottom of the chart outside OnRender?

    Thanks.

    #2
    Hello digibob,

    Thank you for your post.

    If you wanted to fill a region between a value (say a 20 period simple moving average) and the upper edge of the chart, pass in an extreme value to the "Y" parameter such as 1000000. Conversely, if you wanted to fill the region between the same value at the bottom of the chart, you'd want to pass in 0 to the "Y" parameter.

    Here's a link to our help guide regarding Draw.Region():


    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate. Thanks for the reply. That's not exactly what I'm looking for. My series is not the same scale as the price, however I want it displayed on the price panel. Think of it as a background image that can be scrolled horizontally along with the chart but is independent vertically, so that when the chart's Y axis scale changes, the price may overlap the "background image" and that's ok.

      Currently it can be achieved in OnRender (I think) but would require a loop through the bars. Such a loop in OnRender is not advised as per this thread. I guess it could make the scrolling of the chart choppy among other things.

      So if I don't have the chart metrics in OnBarUpdate, and I should avoid a loop through the bars in OnRender, what other options do I have?

      In addition, while processing the bars you'd want to make full use of the entire chart area, place things in the corners, make other things appear from the right or left side, and so on. Specifically the chart bounds, as well as the chart's FromIndex and ToIndex, should be available in OnBarUpdate. I'm hoping there is a way to obtains these. If not, let's make it a feature request?

      Comment


        #4
        Hello digibob,

        Thank you for your reply.

        For the type of rendering you're looking for, you would need to use SharpDX. Draw.Region would not be appropriate for such a circumstance. I would highly suggest reviewing the SampleCustomRender indicator as this contains many of the rendering functions it sounds like you would need. SharpDX is the equivalent of what the CustomPlotSample was demonstrating so learning SharpDX would be required to recreate the effects that script gives.

        Here's a link to our help guide on using SharpDX:



        Please let us know if we may be of further assistance to you.

        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Yes I looked at the SampleCustomRender indicator prior to asking the question as I mentioned in my first post. It was the very reason for asking the question so no need to send me back one step. The problem as I said is that it's not advised to loop through the bars in OnRender. So going this way is not a good solution. Please ask the dev team to allow access to chart attributes in OnBarUpdate, because, if we're allowed to draw in OnBarUpdate, it goes without saying that we should know the boundaries of the "canvas", instead of drawing just 'somewhere in the middle' and hoping not to cross the borders or mess up the scale. Thank you.

          Comment


            #6
            Hello digibob,

            Thank you for your reply.

            I'd recommend trying ScaleJustification == ScaleJustification.Overlay. This should keep the region attached to the X-axis but not the Y-axis. More information is available in our help guide here:



            Any logic in OnRender() isn't advised unless absolutely necessary, especially creating new objects.

            I think we can certainly put in a request for a drawing tool enhancement for you; however, the behavior you seek is currently not supported. I will put in this request and follow up with you once I have a tracking number.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rtwave, 04-12-2024, 09:30 AM
            5 responses
            37 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by funk10101, Today, 12:02 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by GLFX005, Today, 03:23 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by nandhumca, Yesterday, 03:41 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by The_Sec, Yesterday, 03:37 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X