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

Logic for where/how a plot is plotted

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

    Logic for where/how a plot is plotted

    Hi,

    Hi,

    I'm having trouble plotting an indicator of my own and I think it's because I don't understand the plot logic. I want to plot this "Slope(HMA(Fast), 2, 1)/TickSize" and I can't seem to get a line to be drawn. Can anyone help with how to get it to plot?

    I looked at the support guide and below is an example from it for AddPlot(). I have two questions. From how this is written, how does "AddPlot(Brushes.Blue, "PlotA"); " know to plot the "Values[0][0] = Median[0]; " Why is that the one it will plot?


    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Name = "Examples Indicator";

    // Add three plots and associated Series<double> objects
    AddPlot(Brushes.Blue, "PlotA"); // Defines the plot for Values[0]
    AddPlot(Brushes.Red, "PlotB"); // Defines the plot for Values[1]
    AddPlot(Brushes.Green, "PlotC"); // Defines the plot for Values[2]
    }
    }
    protected override void OnBarUpdate()
    {
    Values[0][0] = Median[0]; // Blue "Plot A"
    Values[1][0] = Low[0]; // Red "Plot B"
    Values[2][0] = High[0]; // Green "Plot C"
    }

    #2
    Hello Seastragg,

    Thanks for your post.

    From the help guide for Values: Holds an array of ISeries<double> objects holding hold the indicator's underlying calculated values. ISeries<double> values are added to this array when calling the AddPlot() method. In case of a MultiSeries indicator synched to the primary series. Reference: https://ninjatrader.com/support/help...t8/?values.htm So this is advising that using AddPlot() automatically provides the Values data series. For clarity, the order./sequence of the addPlot statements relates directly to Values[0], Values[1], Values[2] as shown in the help guide section you copied, thus PlotA points to Values[0], PlotB points to Values[1], etc. If you change the order of addplots(), for example putting PlotC first, then plotC would point to Values[0]

    The values of Slope() are likely to be quite small so make sure you are plotting in an indicator panel and not the price panel. Creating an indicator panel is done by setting IsOverLay to false: Reference: https://ninjatrader.com/support/help...?isoverlay.htm

    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Lumbeezl, 01-11-2022, 06:50 PM
    31 responses
    817 views
    1 like
    Last Post NinjaTrader_Adrian  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    5 responses
    14 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by swestendorf, Today, 11:14 AM
    2 responses
    6 views
    0 likes
    Last Post NinjaTrader_Kimberly  
    Started by Mupulen, Today, 11:26 AM
    0 responses
    6 views
    0 likes
    Last Post Mupulen
    by Mupulen
     
    Started by Sparkyboy, Today, 10:57 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X