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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    82 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X