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

Adding A Legend To A Chart Panel

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

    Adding A Legend To A Chart Panel

    I have a strategy that runs on several series and is very much state based. So what I imagine is plotting a 'legend' style box on the chart that lists the respective state of each series and that of various indicators. The simple solution would be to plot this info to one of the output panels but I would like to see it on the chart. What is the best/easiest way of accomplishing this?

    Thanks in advance.

    #2
    Hello molecool,

    Thank you for the post.

    The best way to do this would be to use OnRender. You could make a custom legend however you wanted, for example showing text and a colored rectangle for the plot color next to the text. OnRender is X/Y based so you could do something based on the chart panel coordinates rather than bar/price. Downside is this is more complex to learn initially.

    The simple or basic way would be to use text objects. You would likely need to find the maximum price and draw at the current bar and at that price, then offset the text every X ticks of price or use the Y offset field from that max price for each new line. it would be much more cumbersome and likely would not handle scaling well. OnRender would be suggested for anything that needs to be static or not price/bar based.

    If you are not familiar with OnRender you can see the SampleCustomRender indicator for an example.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you - this is helpful.

      Comment


        #4
        Hi, is there an easy way to show the bid and ask on the chart as text? Basically I would just like to have the current bid and ask on the chart as a legend, I feel it's simple but can't find the way to do it. Thanks!! Have a great year full of successful trades!

        Comment


          #5
          Hello RT001,

          The comment in post 2 would also apply to what you are asking, you would substitute the text for the bid or ask. You can use either Draw.Text or OnRender to draw text on the chart.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by itrader46, Today, 09:04 AM
          0 responses
          3 views
          0 likes
          Last Post itrader46  
          Started by timmbbo, Today, 08:59 AM
          0 responses
          1 view
          0 likes
          Last Post timmbbo
          by timmbbo
           
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          14 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X