Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot High Low

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

  • merzo
    replied
    Hi ChelseaB,

    yes, it is correct!

    Thanks for your tips

    Tomorrow I will study the script HeikenAshi


    Best

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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

    Leave a comment:


  • merzo
    replied
    Thanks for your help ChelseaB

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

    No suggestions?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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);

    Leave a comment:


  • merzo
    started a topic Plot High Low

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by ashwagandhaplus, Today, 12:04 AM
0 responses
6 views
0 likes
Last Post ashwagandhaplus  
Started by ashwagandhaplus, Today, 12:02 AM
0 responses
5 views
0 likes
Last Post ashwagandhaplus  
Started by truvalastfrnce, Today, 12:01 AM
0 responses
4 views
0 likes
Last Post truvalastfrnce  
Started by truvalastfrnce, Today, 12:00 AM
0 responses
4 views
0 likes
Last Post truvalastfrnce  
Started by Ericawin, Yesterday, 11:57 PM
0 responses
6 views
0 likes
Last Post Ericawin  
Working...
X