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

Draw Horizontal Lines and Lines in Strategy Builder

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

    Draw Horizontal Lines and Lines in Strategy Builder

    Hi,

    I would like to know how could I draw a line that will remains on for 5 days (1 week) and this line will be trigger by like an indicator.

    Example: MACD line crossed below AVG line then draw a line from the close of the current candle.

    Thanks

    #2
    Hello hellzer,

    Thanks for your post.

    I'm not sure I understand what you are wanting to accomplish.

    Are you wanting to draw the lines in an indicator or draw the lines in the strategy builder?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I want to be able to draw a support or resistance lines when one of my indicator trigger a cross over or cross below. I want to do that by using the strategy builder.

      Comment


        #4
        Hello heilzer,

        Thanks for your reply.

        In the strategy builder can you see your indicator that provides the signal and does it have a plot that you can access in the strategy builder?


        Paul H.NinjaTrader Customer Service

        Comment


          #5
          the only way that I was able to draw a line is in the Do the following section in the conditions and actions tab. I can add a drawing action but I dont know how to use it properly.
          I wanted to to create a line at the low of a candle or like when the MAC line cross above the AVG line.

          Comment


            #6
            Hello hellzer,

            Thanks for your reply.

            What you can do would be to draw horizontal lines as these will only need the Low[0] price added as the start point. You could also add a draw marker such as a diamond to be able to see where on the chart the horizontal line was created. (See attached).

            Alternatively you could draw a Ray. A ray has the advantage that it draws only in one direction, however you would have to start the ray at the bar before the actual MACD cross in order to draw the ray perfectly horizontal (see attached).

            I am unsure how you would remove the lines after X days in the strategy builder although you do have the draw methods of RemoveDrawObject which would you need to provide the tag name used or RemoveDrawobjects() which will remove every draw object.

            Click image for larger version

Name:	hellzer-1.PNG
Views:	1816
Size:	49.1 KB
ID:	1099493

            Click image for larger version

Name:	hellzer-2.PNG
Views:	1622
Size:	53.7 KB
ID:	1099494

            Here is a link to a short video that covers how to place draw objects relative to price and to show more than just one draw object of the same type: https://paul-ninjatrader.tinytake.co...MF8xMTMwNTc0MA
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thanks a lot, very helpful!
              I have encounter a small issue, I want to currently use the Ray to draw a line horizontally to will start from a bar and end to the right ( the future) but I'm only able to do it vertically or horizontally towards the left (the old market price)

              Comment


                #8
                Hello hellzer,

                Thanks for your reply.

                I addressed that in my previous reply: "however you would have to start the ray at the bar before the actual MACD cross in order to draw the ray perfectly horizontal ". If you look at the screenshot in post #6 you will see that the ray starts 1 bar before the red diamond. The red diamond shows where the macd cross condition was true.

                I've attached an example of this from the strategy builder when selecting the Ray. Note the start bar is 1, the end bar is 0 and the Y values are the same price level..


                Click image for larger version

Name:	Hellzer-3.PNG
Views:	1513
Size:	9.7 KB
ID:	1099563

                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Perfect! So now I would like to know if it's possible to trigger an Action when something cross above or below that line that I created? If not, do we have a way to create a line and then use it to trigger an Action? I wasn't able to figure out something about it.

                  Thnaks

                  Comment


                    #10
                    Hello hellzer,

                    Thanks for your reply.

                    Well, you are creating the line/ray from a specific price level so if when you draw the line you also save that price level in a variable. In another set you can test to see if price crossAbove or crossBelow that price level. The issue here would be that you would be limited in how many variables you could program for.

                    Alternative to a strategy, you can manually draw lines on the chart and use "Chart Alerts" to trigger some action.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Thank you for the help, I understand more now.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by nightstalker, Today, 02:05 PM
                      0 responses
                      1 view
                      0 likes
                      Last Post nightstalker  
                      Started by llanqui, Yesterday, 09:59 AM
                      8 responses
                      28 views
                      0 likes
                      Last Post llanqui
                      by llanqui
                       
                      Started by quicksandatl, Today, 01:39 PM
                      1 response
                      3 views
                      0 likes
                      Last Post quicksandatl  
                      Started by md4866, 05-01-2024, 08:15 PM
                      2 responses
                      18 views
                      0 likes
                      Last Post md4866
                      by md4866
                       
                      Started by samish18, Today, 12:20 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post samish18  
                      Working...
                      X