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

Need help drawing custom plots.

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

    Need help drawing custom plots.

    I want to simply draw a short horizontal line for each data point value except if the plot value price is zero. Not sure how to get the x/y coordinate right for drawing lines.

    Code:
     protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                // Loop through each Plot Values on the chart and draw short line above the bar           
            }

    #2
    Hello bryanhill7, and thank you for your question.


    Attached is a code sample that accomplishes this goal. Code samples we provide are for educational purposes, and are not intended for live trading, and are not guaranteed to accomplish any user goal or to be maintained.


    Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      I threw this in a new NT8 indicator... nothing draws.

      Comment


        #4
        8.0.5.2 64-bit (Standard)

        Comment


          #5
          There was a code error in the previous version which survived my initial tests. The code attached to this post has been verified to draw correctly in the most recent version of NinjaTrader.

          This said the code error in the original version was not related to your query directly. Please, in either the version attached to this post or the previous post, run a New -> NinjaScript Output Window prior to loading this indicator. This contains information directly related to your query. Both the code attached to this reply and the previous code will print information which shows you X and Y pixel coordinates, and comparing this output to the Print statement that generated it will resolve your query.

          The code attached to the previous post will be easier to read, as it will generate less output. I removed this filtering in order to draw objects you can see onto your chart, as objects not rendered during each call of OnRender will be erased. This is the cause of the increased level of output between scripts.
          Attached Files
          Last edited by NinjaTrader_JessicaP; 04-17-2017, 10:16 AM.
          Jessica P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,607 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          15 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X