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

Painting a indicator panel region

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

    Painting a indicator panel region

    Hello

    I am wondering how I could paint an indicator ( which value is between 0 and 1 ) region from 75 to 100 and 0 to 25 based on certain conditions.

    Should I use AddPlot PlotStyle.Bar ?

    if so how can I draw a bar from 75 to 100 ?
    I think that 0 to 25 could be done easily because the start line starts at 0.

    Thank you very much.



    #2
    Hello bar58,

    Thanks for your post.

    I'm not exactly understanding what you are trying to do. Do you mean that under some conditions, your 0-1 value will be translated to 75-100 and under other conditions translate it from 0-25?

    This could be done by normalizing your indicator's plot value to the intended range. A publicly available resource on normalization can be found below.

    https://stackoverflow.com/questions/...-to-3/51161208

    Choosing a different Plot Style will change the appearance of your plot, which I am not sure is the ultimate goal here.

    If you need additional help, could you attach a screenshot with some drawings depicting what you are trying to do?

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      I would like to paint on certain conditions region 0-25 and 75-100. See the attachment
      Attached Files

      Comment


        #4
        I am almost done.
        My only problem is that I would like the red painted area to start at 75 level instead of 0.

        Attached Files

        Comment


          #5
          Hello blar58,

          Thanks for clarifying.

          You could consider using Draw objects to draw where you would like in the indicator panel, with DrawOnPricePanel set to false, but it may be expensive to use drawing objects excessively.

          Outside of this there would not be a quick way to accomplish with Plots. You could accomplish this with custom SharpDX rendering however. For example, you can use ChartScale.GetYByValue and provide your normalized values for the upper range there, and you will get the pixel Y coordinate for where you would want to make that drawing. For the X coordinate, you can use ChartControl.GetXByBarIndex.

          You could consider using RenderTarget.DrawRectangle or RenderTarget.DrawLine to draw in this area after you have gotten your coordinates.

          ChartScale.GetYByValue - https://ninjatrader.com/support/help...etybyvalue.htm

          ChartControl.GetXByBarIndex - https://ninjatrader.com/support/help...bybarindex.htm

          To get more acquainted with SharpDX rendering, please see the Help Guide article below, and please see the SampleCustomRender indicator that comes with NinjaTrader.
          https://ninjatrader.com/support/help..._rendering.htm

          We look forward to assisting.
          JimNinjaTrader Customer Service

          Comment


            #6
            Very well understood

            Many thanks Jim

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            5 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            7 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            19 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X