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 a Line on Low and High of Each Candle

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

    Draw a Line on Low and High of Each Candle

    Hi there, I am stuck at this problem. How can a create a simple strategy on builder that can Draw a line on the low and high of every candle ? Thanks for any help.

    #2
    Hello denymachado,

    Thanks for your post.

    To draw a line on the chart you could use the Line drawing tool found in the Strategy Builder by going to Conditions and Actions screen > Actions section > add > Drawing folder > Line.

    The 'Start Y' and 'End Y' properties could be set to the High price (Price folder > High) to draw the line at the High of the bar. You could set the 'Tag' property to use a unique tag name, such as using 'Current bar' (Misc folder > Current bar), each time the method is called so a new line is drawn on each bar.

    The 'Start Y' and 'End Y' properties could be set to the Low price (Price folder > Low) to draw the line at the Low of the bar.

    I have attached a simple Strategy Builder script that demonstrates drawing a line at the High of a bar. You could view the script to see how this is accomplished and then implement similar logic to draw a line at the Low of a bar.

    See the help guide documentation below for more information.

    Conditions: https://ninjatrader.com/support/help...on_builder.htm
    Actions: https://ninjatrader.com/support/help...t8/actions.htm
    Draw.Line(): https://ninjatrader.com/support/help.../draw_line.htm
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the fast response it did work, but it was slowing my charts I guess its too much calculation, would that be a way to have the lines only on the current candle ? or Erase the past lines ?

      Comment


        #4
        Hello denymachado,

        Thanks for your notes.

        To have the lines drawn only on the current bar, you could give the Draw.Line() methods a static Tag name instead of a unique Tag name.

        For example, you could remove 'CurrentBar' from the Tag name of the Draw.Line() method in the sample script shared on post # 2 so that the Tag property is only "Line".

        See the 'How to draw on chart' section of this help guide page: https://ninjatrader.com/support/help...t8/actions.htm

        Draw.Line(): https://ninjatrader.com/support/help.../draw_line.htm
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          denymachado If I have understood correctly, you would like to draw a line for the high and low of each bar. This is because drawing a Line on Close only draws a line through the closing price and not the high price or the low price of the bar.

          Here's a workaround that I came up with.

          1) Add the stock Ninja SMA to your chart. Change the period to 1.
          2) Select the instrument you want to use as the Input Series.
          3) In that same window on the right, select High or Low as Price Type. (see second screenshot)
          4) Repeat steps 1-3 but select Low for step 3.

          The third screenshot shows the solid red line as just the instrument plotted as Line on Close. The dashed line now plots the high of each bar.

          Hope this helps.

          P.S. NinjaTrader_BrandonH I just wish Ninja would allow plotting multiple standardized lines/instruments/indicators with dissimilar unit scales in overlay mode. Currently, it just allows one per left, right or overlay scale.

          Click image for larger version

Name:	image.png
Views:	180
Size:	101.6 KB
ID:	1288702

          Comment


            #6
            Hello oldporkchops,

            Thanks for your notes.

            To clarfy, do you want to have the same indicator to plot multiple plots on the chart calculated from different values, such as Close, High, or Low?

            If so, you could add multiple instances of the same indicator to the chart, set each indicator instance to 'Overlay', set the Dash style you want each indicator instance to use, and set the Input series you want each of the indicators to calculate from.

            Working with Indicators: https://ninjatrader.com/support/help...indicators.htm

            Please let me know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by strategist007, Today, 07:51 PM
            0 responses
            1 view
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,967 views
            3 likes
            Last Post jhudas88  
            Started by rbeckmann05, Today, 06:48 PM
            0 responses
            4 views
            0 likes
            Last Post rbeckmann05  
            Started by rhyminkevin, Today, 04:58 PM
            4 responses
            55 views
            0 likes
            Last Post dp8282
            by dp8282
             
            Started by iceman2018, Today, 05:07 PM
            0 responses
            6 views
            0 likes
            Last Post iceman2018  
            Working...
            X