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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    54 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    34 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    57 views
    0 likes
    Last Post PaulMohn  
    Working...
    X