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 DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    41 views
    0 likes
    Last Post alifarahani  
    Working...
    X