• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot High Low

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

    Plot High Low

    Hello,

    I have the following problem:

    I finished an indicator and I need to plot its High and Low

    if (FirstTickOfBar)
    {
    dsOpen.Set( lastvalueINDICATOR );
    hi = lastvalueINDICATOR;
    lo = lastvalueINDICATOR;
    }

    hi = Math.Max( hi, lastvalueINDICATOR );
    lo = Math.Min( lo, lastvalueINDICATOR );

    dsClose.Set( lastvalueINDICATOR );
    dsHigh.Set( hi );
    dsLow.Set( lo );

    ok this works well, I have checked on Output window

    How can I plot dsHigh.Set and dsLow.Set simultaneously?

    I am trying:

    DrawLine("INDICATOR"+CurrentBar, true , 0, dsLow[0], 0, dsHigh[0], Color.FromArgb(255,255,255,255), DashStyle.Solid, 2);

    but unfortunately began when I enter the oscillator, it don't plot the historical data sets on dsHigh.Set and dsLow.Set

    Thanks for your help

    #2
    Hello merzo,

    To plot values you will need to add a new plot to your indicator and then set the values for that plot.

    The plot will appear on the chart connecting the points of each bar automatically when the script is enabled.

    http://ninjatrader.com/support/helpGuides/nt7/add.htm

    Code:
    Add(new Plot(Color.Blue, "dsHigh"));
    Add(new Plot(Color.Orange, "dsLow"));
    Code:
    Values[0].Set(dsHigh[0]);
    Values[1].Set(dsLow[0]);

    If you want to draw a line, you can do this but it would not be a plot that contains a value for each bar. You would need to use a different bars ago value for the start and end bars ago to see the line. (A line need to be drawn between two or more bars).

    DrawLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)
    Code:
    DrawLine("dsHighLine"+CurrentBar, true , 5, dsHigh[0], 0, dsHigh[0], Color.FromArgb(255,255,255,255), DashStyle.Solid, 2);
    DrawLine("dsLowLine"+CurrentBar, true , 5, dsLow[0], 0, dsLow[0], Color.FromArgb(255,255,255,255), DashStyle.Solid, 2);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your help ChelseaB

      Unfortunately it's not what I'm looking for
      I would get a graph like HiLo

      No suggestions?

      Comment


        #4
        Hi merzo,

        Ok, I can understand that. You'd like to draw a line on a single bar to mark a point on that bar at a specific price (similar to the HiLo chart style). Is this correct?

        To achieve this you would need to draw lines or rectangles using the Plot override at very specific x and y points.

        The HeikenAshi indicator also does custom rendering over the bar.
        (Tools -> Edit NinjaScript -> Indicator... -> HeikenAshi -> OK)

        Line 256:
        graphics.FillRectangle(brushDown, x - barPaintWidth / 2, y1, barPaintWidth, y4 - y1);

        You could use the graphics library from GDI+ that is provided from the Plot override in NinjaTrader.
        public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)

        This path of custom rendering is not documented in the help guide. However, the HeikenAshi provides a very good example of how this would be done and can be opened from the NinjaScript editor.

        The HiLo chart style (and all chart styles) also use this graphics GDI+ library to render on the chart. However, these cannot be opened in the NinjaScript Editor and must be opened in a 3rd party text editor (I suggest VisualStudio).
        These can be found in:
        Documents\NinjaTrader 7\bin\Custom\Type\@ChartStyles.cs
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi ChelseaB,

          yes, it is correct!

          Thanks for your tips

          Tomorrow I will study the script HeikenAshi


          Best

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by faisamtrader, Yesterday, 10:03 PM
          0 responses
          3 views
          0 likes
          Last Post faisamtrader  
          Started by johnnybegoode, Yesterday, 08:11 PM
          0 responses
          2 views
          0 likes
          Last Post johnnybegoode  
          Started by Bionian, Yesterday, 02:47 PM
          2 responses
          21 views
          0 likes
          Last Post Bionian
          by Bionian
           
          Started by RickB60, Yesterday, 01:55 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by filopearson, Yesterday, 01:18 PM
          6 responses
          11 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X