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

Custom Drawing Tool HorizontalLines

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

    Custom Drawing Tool HorizontalLines

    Hi guys!

    I want to code a custom drawing tool that draws not only one horizontal line when I click the high or the low of a bar with the crosshair but multiple horizontal lines around these points.

    I looked at "Using SharpDX for Custom Chart Rendering" in NinjaScript Reference Guide. I would like to know if this kind of tool needs ShardDX. Could it be coded in standard NinjaScript?

    I also read two or three other users' solutions for plotting labeled lines, but I'm not interested in labels, just in multiple horizontal lines above and below a price.

    So, I started stripping unnecessary text-handling code but ended up in a mess. I still need to sort out the overall code structure of this tool, meaning understanding where to create my logic and custom resources like brushes and strokes and how to integrate it into the Drawing Panel of NinjaTrader.

    Last but not least, how do we configure it to be used and exported?
    What structure should the final .zip file have?​​

    #2
    Hello Gianpiero,

    Yes, all custom drawing tools would be rendered with SharpDX in OnRender().

    The TrendLines and Fibonacci drawing tools may give you some ideas about rendering multiple lines with a given set of anchor points.

    Below is a link to an exported custom drawing tool.
    https://ninjatrader.com/support/foru...817#post798817

    The final .zip should have the structure that NinjaTrader creates when it is exported from NinjaTrader.

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    Last edited by NinjaTrader_ChelseaB; 12-14-2022, 02:18 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you a lot!

      I'll look into this.

      PS - The last link doesn't work for me. I get a page Not Found message.

      Comment


        #4
        I have trouble finding the code implementing the TrendLines and Fibonacci drawing tools. I would appreciate your help very much, given that I need to plot a set of horizontal lines offset ± four ticks above and below, starting from the price where I draw the first line horizontal line when I click the High or the Low of the bar (the Anchor Y of the object).

        Comment


          #5
          I found them. Usually, I don't mess around with code with a @ in front of its name.

          Comment


            #6
            Hello Gianpiero,

            The links in my post are working on my end.

            May I confirm you are clicking the link and not copying and pasting the link? (It's abbreviated on the forum)

            If you right-click the link and open in a new tab does it open correctly?

            In the @FibonacciTools script, the rendering of the lines is on lines 243 to 274.
            In the @TrendChannel script, the rendering of lines is on lines 535 to 844.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks again!

              I guess my browser lands on a different page from yours. I get Error 404, alias not found, from a web page in Italian, which I hardly think matches yours

              Comment


                #8
                Hello Gianpiero,

                Thank you for letting me know you have the language set to italian. I was sending the link to the english page, though I still would expect that to load.

                Below is a generic link to the page.
                https://ninjatrader.com/support/help...nt8/export.htm
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Chelsea!

                  Yes! La last link links like a charm.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by kevinenergy, 02-17-2023, 12:42 PM
                  117 responses
                  2,766 views
                  1 like
                  Last Post jculp
                  by jculp
                   
                  Started by Mongo, Today, 11:05 AM
                  5 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by SightCareAubetter, Today, 12:55 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post SightCareAubetter  
                  Started by traderqz, Today, 12:06 AM
                  8 responses
                  16 views
                  0 likes
                  Last Post traderqz  
                  Started by SightCareAubetter, Today, 12:50 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post SightCareAubetter  
                  Working...
                  X