Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing data from Multiple Symbols

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

    Accessing data from Multiple Symbols

    I have a chart with four symbols on it and I want to access the data in NinjaScript.

    I can't even get the basics to work. The following script attempts to plot the closing prices for the second dataseries on the screen but I get no values plotted.

    Any help is appreciated
    thanks


    Code:
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                Overlay				= false;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                Plot0.Set(Closes[1][0]);
            }

    #2
    Hello,

    Thanks for your note.

    You actually cant tie NInjaScript to an already existing chart with 4 symbols on it.

    You need to add this symbol into the script internally however.

    Therefor to get Closes[0][1] to work, you would need to have Add("ES 03-11", PeriodType.Minute, 1); for example in your Initialize().




    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Bret,

      Thank you so much. That sets me straight. I also realize that I have posted in the wrong area so that is a rookie mistake, sorry.

      Another quick question. Is there anyway to query parameters for the current chart that a strategy is enabled on? For instance, I am floating text on multiple indicator lines and when a user changes that line color via the parameter box I would like the text to change color to match.

      Comment


        #4
        redliontrader, this is unfortunately not possible per default as the strategy would not cross commnuicate.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        72 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        39 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X