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

Plotting Question - Syntax

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

    Plotting Question - Syntax

    Hi All!

    I'm new to the group, and new to NinjaTrader.... I was informed that this is the best charting platform on the planet, so thought I'd give it a whirl!

    So far, I agree!! Every product has pros/cons, but this seems to have a lot more Pros than Cons.... (there was a pun in there too if you look close )

    Anyhow...

    I'm learning NinjaScript / C# ( I have an extensive C++ background, so programming in general is not a problem for me), and I'm not sure that I understand a fairly basic concept.

    I'm looking at 2 built-in indicators as examples, ADL and ADX.

    AD uses something like:
    Add(new Plot(Color.Green, PlotStyle.Line, "AD"));
    AD.Set( ... )

    while ADX uses something like:
    Add(new Plot(Color.Green, "ADX"));
    Add(
    new Line(Color.DarkViolet, 25, "Lower"));
    Add(
    new Line(Color.YellowGreen, 75, "Upper"));
    Value.Set( .... )


    I thought that the AD.Set() would be a plot, while Value.set() would just store a value, but they both seem to plot, so I'm feeling that I'm missing something quite basic

    Any help would be greatly appreciated!

    Thanks

    Matt




    #2
    "Value" is a property of type DataSeries that points to the DataSeries object in the collection Values[]. In fact, it points to Values[0]. Values[] is a collection of DataSeries objects that store values of the indicator. Plot objects just characterize how the values are visually displayed.

    If you expand the "Properties" region in the ADL indicator, you will see that "AD" is a property that refers to "Values[0]".

    Thus in the ADL indicator, all of the following three approaches would accomplish the same thing:

    AD.Set(value)
    Value.Set(value)
    Values[0].Set(value)

    Most of our own indicators skip the creation of a property and directly set values in via Value.Set(). You will see properties used when there are more than one plot. Look at Bollinger for example. When more than one plot is used, we use properties so that when you wish to access one of these plots, you would :

    Bollinger().Upper[0]

    to get the value of the current bar upper plot. If Bollinger only had one plot, by default internal you would just:

    Bollinger()[0]

    since this always refers to the plot value at Values[0].

    Hope that makes sense.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NRITV, Today, 01:15 PM
    2 responses
    6 views
    0 likes
    Last Post NRITV
    by NRITV
     
    Started by frankthearm, Today, 09:08 AM
    7 responses
    31 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by maybeimnotrader, Yesterday, 05:46 PM
    5 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by quantismo, Yesterday, 05:13 PM
    2 responses
    19 views
    0 likes
    Last Post quantismo  
    Started by adeelshahzad, Today, 03:54 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X