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

drawing a horizontal line on every bar of an indicator

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

    drawing a horizontal line on every bar of an indicator

    Hi,

    I have an indicator that calculates zones on every bar. For this example, let's just say I have one zone with a high and low value.
    I have created an indicator with outputs, eg:
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ZoneA_H"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ZoneA_L"));


    Everything is working correctly and this works for strategies reading the indicator, however visually it's not what I want.

    To explain, I would like to see horizontal lines drawn on each bar I add this indicator to (as opposed to a line that connects up with the next value on the next bar).
    I have tried changing the PlotSyle to HLine, however this only draws the latest horizontal line value across the entire chart.

    Ultimately what I want to do here is add this indicator (that defines zones) to say a 60 minute chart. Add another data series (say a 5 minute) to the chart window, and instruct the indicator above output to the 5 minute chart. The idea being that I would see the 2 horizontal lines drawn showing the zone I define for the 60 minute timeframe.

    I've attached a rough diagram showing the current output of the indicator, and what I would like to see (drawn in pink lines).

    How can I code this so it draws lines visually like this?

    thanks
    Attached Files

    #2
    Originally posted by PolarBear View Post
    Hi,

    I have an indicator that calculates zones on every bar. For this example, let's just say I have one zone with a high and low value.
    I have created an indicator with outputs, eg:
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ZoneA_H"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ZoneA_L"));


    Everything is working correctly and this works for strategies reading the indicator, however visually it's not what I want.

    To explain, I would like to see horizontal lines drawn on each bar I add this indicator to (as opposed to a line that connects up with the next value on the next bar).
    I have tried changing the PlotSyle to HLine, however this only draws the latest horizontal line value across the entire chart.

    Ultimately what I want to do here is add this indicator (that defines zones) to say a 60 minute chart. Add another data series (say a 5 minute) to the chart window, and instruct the indicator above output to the 5 minute chart. The idea being that I would see the 2 horizontal lines drawn showing the zone I define for the 60 minute timeframe.

    I've attached a rough diagram showing the current output of the indicator, and what I would like to see (drawn in pink lines).

    How can I code this so it draws lines visually like this?

    thanks
    It looks like you will have to use a multi-timeframe indicator and make your Plots reference the desired barSeries.

    Comment


      #3
      hi, thanks for the reply but i don't think that you have understood my post. there's nothing to do with multi time frame data series. I just want the line that the indicator line draws on the chart to go horizontal between bars then down/up to the next value on the next bar.
      I don't want diagnol lines connecting the successive points on each bar.
      Think of it like daily pivot points. On each day you want the daily pivolt point to be a consistent value across the day, then on the new bar jump to the new value.

      i hope this is clear
      thanks

      Comment


        #4
        Originally posted by PolarBear View Post
        hi, thanks for the reply but i don't think that you have understood my post. there's nothing to do with multi time frame data series. I just want the line that the indicator line draws on the chart to go horizontal between bars then down/up to the next value on the next bar.
        I don't want diagnol lines connecting the successive points on each bar.
        Think of it like daily pivot points. On each day you want the daily pivolt point to be a consistent value across the day, then on the new bar jump to the new value.

        i hope this is clear
        thanks
        I think Koganam was looking ahead to your next step of the problem where you said:

        "Ultimately what I want to do here is add this indicator (that defines zones) to say a 60 minute chart. Add another data series (say a 5 minute) to the chart window, and instruct the indicator above output to the 5 minute chart. The idea being that I would see the 2 horizontal lines drawn showing the zone I define for the 60 minute timeframe."

        It sounds like you need to stop using plots, and use DrawLines.
        Last edited by sledge; 10-07-2012, 08:59 AM. Reason: typos

        Comment


          #5
          Originally posted by PolarBear View Post
          hi, thanks for the reply but i don't think that you have understood my post. there's nothing to do with multi time frame data series. I just want the line that the indicator line draws on the chart to go horizontal between bars then down/up to the next value on the next bar.
          I don't want diagnol lines connecting the successive points on each bar.
          Think of it like daily pivot points. On each day you want the daily pivolt point to be a consistent value across the day, then on the new bar jump to the new value.

          i hope this is clear
          thanks
          You cannot have an indicator in one panel plot on another panel, so your description (and even your diagram) both mean that you need a multi-timeframe indicator, even if that is not what you intended to describe.

          Comment


            #6
            Hi Guys,

            Sorry if I didn't explain correctly the first time but I think it was misleading to even show the other time frame in the diagram as this is causing confusion.

            to clarify:

            a) Yes you can draw the indicator on another window. It's a new feature in NT7 where you place an indicator on a chart. You set the data series that you want to base the indicator on (eg: Daily Close) and with the defaults this plots the indicator on the Daily chart. You can then actually change the window/panel this plots this indicator on by changing the Visual->Panel setting to a different panel number. Please refer screenshot again I've attached which shows that you can do this. This however is nothing to do with what I'm asking here but FYI.

            b) What I am asking is can you draw sequences of horizontal lines that draw from the start of the bar (when the bar is drawn) across to the next bar based on the value of the indicator for that bar (the value when the bar is drawn).
            I've shown this again on the next screen shot. This is what it should look like just on a single timeframe with the indicator.
            The Pink lines show what I want to draw. The green lines are currently what's drawn for the 2 indicator plot outputs

            thanks
            Daniel
            Attached Files

            Comment


              #7
              Originally posted by PolarBear View Post
              Hi Guys,

              Sorry if I didn't explain correctly the first time but I think it was misleading to even show the other time frame in the diagram as this is causing confusion.

              to clarify:

              a) Yes you can draw the indicator on another window. It's a new feature in NT7 where you place an indicator on a chart. You set the data series that you want to base the indicator on (eg: Daily Close) and with the defaults this plots the indicator on the Daily chart. You can then actually change the window/panel this plots this indicator on by changing the Visual->Panel setting to a different panel number. Please refer screenshot again I've attached which shows that you can do this. This however is nothing to do with what I'm asking here but FYI.

              b) What I am asking is can you draw sequences of horizontal lines that draw from the start of the bar (when the bar is drawn) across to the next bar based on the value of the indicator for that bar (the value when the bar is drawn).
              I've shown this again on the next screen shot. This is what it should look like just on a single timeframe with the indicator.
              The Pink lines show what I want to draw. The green lines are currently what's drawn for the 2 indicator plot outputs

              thanks
              Daniel
              PlotStyle.Square in code, or select that style in the config GUI.

              Comment


                #8
                awesome thanks, that's exactly what I needed.

                Is there a way to set the high/low value of the square?

                Comment


                  #9
                  Originally posted by PolarBear View Post
                  awesome thanks, that's exactly what I needed.

                  Is there a way to set the high/low value of the square?
                  I do not understand the question. The Plot determines where the line is drawn. Set the Plot to whatever value you want.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by benmarkal, Yesterday, 12:52 PM
                  3 responses
                  22 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by helpwanted, Today, 03:06 AM
                  1 response
                  17 views
                  0 likes
                  Last Post sarafuenonly123  
                  Started by Brevo, Today, 01:45 AM
                  0 responses
                  11 views
                  0 likes
                  Last Post Brevo
                  by Brevo
                   
                  Started by aussugardefender, Today, 01:07 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post aussugardefender  
                  Started by pvincent, 06-23-2022, 12:53 PM
                  14 responses
                  244 views
                  0 likes
                  Last Post Nyman
                  by Nyman
                   
                  Working...
                  X