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 gravdigaz6, Today, 11:40 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by MarianApalaghiei, Today, 10:49 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by XXtrader, Today, 11:30 PM
          0 responses
          4 views
          0 likes
          Last Post XXtrader  
          Started by love2code2trade, Yesterday, 01:45 PM
          4 responses
          28 views
          0 likes
          Last Post love2code2trade  
          Started by funk10101, Today, 09:43 PM
          0 responses
          9 views
          0 likes
          Last Post funk10101  
          Working...
          X