Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Price Markers

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

    Indicator Price Markers

    Hello,

    I want to ask please how one can have price marker for certain horizontal lines in an indicator but not for all lines. I dont want to run calculation 2 times in 2 indicators with one pricemarkers true and other off.

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thanks for your question.

    Drawing tools cannot place price markers, so I would suggest to create a plot in the script and to set the PlotStyle to HLine to show a horizontal line that has a price marker.

    Code:
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            Description                                    = @"Enter the description for your new custom Indicator here.";
            Name                                        = "HLineTest";
            Calculate                                    = Calculate.OnBarClose;
            IsOverlay                                    = true;
            AddPlot(new Stroke(Brushes.Orange, 2), PlotStyle.HLine, "MyPlotLine");
        }
    }
    
    protected override void OnBarUpdate()
    {
        Values[0][0] = Close[0];
    }
    If you would like to have some HLine plots presented with a price marker and some without, I would suggest to set the Plot Brush to Transparent for the plot that you do not want to have a price marker, and to draw that plot line using SharpDX or using the Horizontal Line drawing tool.

    Reference for using the Horizontal Line drawing tool and some reference on modifying plot appearance with SharpDX is linked below.

    Draw.HorizontalLine - https://ninjatrader.com/support/help...zontalline.htm

    Using SharpDX for custom rendering - https://ninjatrader.com/support/help..._rendering.htm

    OnRender (Please see the "Using multiple SharpDX objects to override the default plot appearance" example at the bottom) - https://ninjatrader.com/support/help...s/onrender.htm

    Keep in mind, if you are using OnRender, you will need to call base.OnRender() within that method's scope for standard plots to display.

    Please let us know if we can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X