Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Today, 09:29 PM
    0 responses
    7 views
    0 likes
    Last Post Belfortbucks  
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    151 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    6 views
    0 likes
    Last Post mattbsea  
    Working...
    X