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 OHLC in an indcator panel

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

    plot OHLC in an indcator panel

    How would I get price bar[s] into an indicator panel?

    I want to have two or more "price panels" in a chart window
    but secondary panel price values will be the "current bar" OHLC
    values modified in special ways.
    The secondary panel uses the same instrument and bar period,
    i.e. this is not a multi time frame/multi instrument question .

    Say the chart window is 5 minutes period, candle sticks.

    I want to duplicate the price action of each 5 minute candlestick of
    the main (top) price panel in an indicator panel.
    That is because I want to perform
    some manipulations on the individual ticks
    before they are plotted in the secondary plot panel
    in order to show a slightly modified high and low
    of the secondary panel's candlestick
    (as compared to the high and low of the main top price panel bars)

    Perhaps the basic question is -
    is there an easy way to draw candlesticks in an indicator panel?
    I know how to find the open, high, low and last of the current bar.
    What I don't know is how to replot those in an indicator panel.

    #2
    Hi roland_nt, you could simply set Overlay to false in your Initialize() - http://www.ninjatrader-support.com/H...6/Overlay.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      want to draw a candle in an indcator panel

      Bertrand:
      Either I don't understand your answer's implications or I haven't made my problem clear.
      I want to place a price bar (candlestick object or graphic or whatever a thing with an open, high, low close might be technically called) in an indicator panel.
      If I understand the capabilities of indicator panels correctly I can only plot lines (which can have any scale) or vertical bars which have a value in the range of 0 to max (where max is some positive number) or a vertical bar in the range of 0 to -max (a negative number) or possibly both (as in MACD).

      There is not a facility to plot in an indicator panel a vertical bar which ranges from
      M to N where M and N are both positive number but N is bigger than M (i.e. the low and hign respectively of a candlestick)
      Am I completely confused?
      Last edited by roland_nt; 04-03-2009, 01:21 PM.

      Comment


        #4
        roland_NT,

        You do not move the price to the indicator, but rather the indicator onto the price. Setting Overlay = true will put the indicator onto the price, false will put it on its own panel.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I am still not being clear, want candlestick in indicator

          Top Price Panel: looks like normal candlestick prices (each vertical line character below is an individual "candlestick", "dot" used control left to right spacing of forum WYSIWG editor)
          .|
          . |
          .. |
          .. . |
          ..... |
          .

          Indicator panel: has almost the same except that I have modified the original OHLC values and plotted new candlesticks (last bar only modified in this example for visibility)

          .|
          . |
          .. |
          .. . | |


          So my question still is: how do I draw candlesticks with my own slightly modified OHLC values in the indicator panel. These values for these new candlesticks are computed and plotted as the normal ones are forming, by analyzing incoming ticks in OnBarUpdate().

          There are thus TWO (or possibly more) panels that have candlestick like things in them in the main chart window - panel 1 and panel 2 (, 3, 4...)
          which are all derived from the price action in panel 1

          I know how to do the tick selection from the panel 1 data stream.
          I know how to get candlesticks in the price panel 1.
          I don't know how to get the candlesticks drawn with my revised OHLC values in the indicator panel 2
          PS: I don't need the exact candle stick color and shape although that would be nice. At a minimum it would be ok to draw just a simple vertical line whose top and bottom height and vertical positioning will more or less mimic panel 1, using the same approximate vertical scale range as the top price panel 1.

          Comment


            #6
            There is no "drawing" candlesticks. You can draw rectangles and lines and that would try and mimic a candlestick, but that is still your own drawing.

            Please see DrawRectangle() and DrawLine(). You will also have to use DrawOnPricePanel = false.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks

              Sorry it took so long to get to this answer.
              Not the answer of my dreams, but at least now I know how much trouble I'm in.
              R.

              Comment


                #8
                can I dra a vertical bar that does not have one end at the zero line

                Is it possible to use a "plot style" of "bar" in the indicator but have the bottom end not always be at zero?
                As a made up code example, say the code looked like

                // set bottom value of "bar" (it would be variable number for each bar, not a constant threshold)
                botVal = Input[0] - .01 * Input[0];
                //load it into a special place yet to be revealed by Josh
                someSecretNTclass.something[0] = botVal; // or SecretPlace.Set(botval);
                // now calculate top of bar
                plotVal = Input[0] + (2.0 / Input[1]);
                // now use a plain old plot
                Plot0.set(plotVal);

                Thus giving a vertical bar segment somewhere above the zero line

                Comment


                  #9
                  roland_NT,

                  You could try using Min plot values. See this tutorial's "Enter Calculation Logic" section http://www.ninjatrader-support.com/H...verview25.html
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    getting close

                    Josh:
                    Thanks for your quick response.

                    Maybe we are almost there.
                    First of all I want to set the Plot.Max or Plot.Min to different values in each bar, i.e during onbarupdate().
                    But it is slightly more complicated.
                    I want the visual effect to be as if the indicator bar was to be painted between two positive non zero values.
                    For example I want the bar painted between 830 (low value, bottom end of visible bar) and 835 (high value) but no bar segment visible between 0 and 829.
                    The next painted bar might be visible between the values 833 and 839 with empty (blank? white?) segment between 0 and 832
                    The next painted bar showing between 834 and 837
                    and so on.
                    That's why I wondered if a way to reset the zero reference in the plotting logic might be a potential solution. So for the first bar in the example above, I would set the "virtual zero" reference at 829.
                    I am not trying skip plotting if the plot value is outside of some threshold as the tutorial offers.
                    Instead, I am trying to just visually display a top piece of what would otherwise be regular vertical bar painted above the zero line.

                    Comment


                      #11
                      roland_NT,

                      Unfortunately you cannot adjust these values every single bar. I suggest you try using DrawLine() instead and just punch in the start value and end values.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by wzgy0920, 04-20-2024, 06:09 PM
                      2 responses
                      26 views
                      0 likes
                      Last Post wzgy0920  
                      Started by wzgy0920, 02-22-2024, 01:11 AM
                      5 responses
                      32 views
                      0 likes
                      Last Post wzgy0920  
                      Started by wzgy0920, Yesterday, 09:53 PM
                      2 responses
                      49 views
                      0 likes
                      Last Post wzgy0920  
                      Started by Kensonprib, 04-28-2021, 10:11 AM
                      5 responses
                      191 views
                      0 likes
                      Last Post Hasadafa  
                      Started by GussJ, 03-04-2020, 03:11 PM
                      11 responses
                      3,230 views
                      0 likes
                      Last Post xiinteractive  
                      Working...
                      X