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

Plot horizontal lines

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

    Plot horizontal lines

    Hi guys,

    Is it possible to use the Strategy Builder to draw horizontal lines on the chart for the following conditions:

    Using a 30 range chart, would like to have strategy plot lines on chart when we have see 8 ticks from open of new bar.

    Thanks

    #2
    Hello KonAdams,

    Welcome to the NinjaTrader forums!

    Below I am providing a link to support article with helpful resources on getting started with NinjaScript. Be sure to watch the 'Automate Your Trading with NinjaTrader's Strategy Builder' training video.


    In the conditions on the left select Price > Close, in the center select Greater, on the right select Price > Open and set the Offset to Ticks with a Value of 8.
    In the actions select Drawing > Horizontal line and set the Y to the price where you would like the line to appear.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea, thanks for the reply.
      I am an absolute newb at NT.
      Was able to set that up as you have suggested. It is not plotting the horizontal lines.

      Any other suggestions?

      Comment


        #4
        Hello realblubb,

        I've recorded a short video showing this code does work.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Oh nice. Once I added that Y value on the line it plotted the line.

          Its not exactly what I wanted.

          Want it to only draw line on current bar only. Also want it to draw a line once a certain Range is met. For example, on a 30 Range chart, as soon as there is a Range of 8, then draw the line.
          Hope that made sense.
          I am currently using just a rectangle that I drag close to current bar on the chart.

          Maybe I should create a video?

          Comment


            #6
            Hello KonAdams,

            "Want it to only draw line on current bar only."

            In this case, do not use a horizontal line and use a regular line instead, and set the start bars ago to 1 and leave the end bars ago at 0 and set the end y and start y to the same price value.

            "For example, on a 30 Range chart, as soon as there is a Range of 8, then draw the line."

            Use Calculate set to OnPriceChange in the strategy parameters and enable TickReplay to draw the line before the bar closes.


            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              How do I set the end y and start y to the same price value?

              Do I use something like the Ask price?

              Comment


                #8
                Hello KonAdams,

                Click set in the value for Start Y, select the price value you want, click set in the value for End Y, select the same price value.

                I chose to use the Price > Close in the video. You can choose any price value you would like to display the line at.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  It is drawing a line, but the line is moving with the price. I just want it to draw a line when a range of 8 for example is met, draw the line and keep it there, static at that price.

                  Comment


                    #10
                    Also, thank you so much for helping me, it is very much appreciated.

                    Comment


                      #11
                      Hello KonAdams,

                      Instead of greater as the operator in the center, use Equal. (Then it won't update if the price is higher or lower than 8 ticks)
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by dtaylor, Yesterday, 02:24 AM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_Eduardo  
                      Started by sofortune, 05-10-2024, 10:28 AM
                      7 responses
                      60 views
                      0 likes
                      Last Post sofortune  
                      Started by saturntd, 05-17-2024, 10:18 PM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_Eduardo  
                      Started by llanqui, Today, 11:26 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post llanqui
                      by llanqui
                       
                      Started by Skifree, 05-07-2024, 11:47 PM
                      2 responses
                      24 views
                      0 likes
                      Last Post Skifree
                      by Skifree
                       
                      Working...
                      X