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

Help with DataSeries and Multi-Instrument Indicator

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

    Help with DataSeries and Multi-Instrument Indicator

    I'm embarking on my first attempt at a Multi-Instrument Indicator and attempting to store and retreve data from a DataSeries. Unfortunately I couldn't find any examples so I feel like I'm flying blind.
    So I'm getting multiple "Class member declaration expected" and "] expected" errors in the following lines of code:

    plArray.Set (Lows[1][0] );
    phArray.Set (Highs[1][0] );
    tlArray.Set (Low[0] );
    thArray.Set (High[0] );
    sigl=false;
    for (int i=0;i<sl;i++) {
    if (tlArray[0]<tlArray[1] && tlArray[0]>tlArray[sTime-aPIVOTL[i]-1] &&
    plArray[0]<=plArray[sTime-aPIVOTL[i]-1]) {

    the following is in the variables region:
    private int sTime = 0;
    private bool sigl = false;
    private int sl = 0;
    private int i = 0;
    private int j = 0;
    private Array aPIVOTL;
    private Array aPIVOTS;
    private DataSeries plArray;
    private DataSeries phArray;
    private DataSeries tlArray;
    private DataSeries thArray;

    and the following is in the initialize
    tlArray = new DataSeries(this);
    thArray = new DataSeries(this);
    plArray = new DataSeries(ES);
    phArray = new DataSeries(ES);
    aPIVOTL = new Array(190);
    aPIVOTS = new Array(190);

    Can someone please help me get on the right track here? Any examples would be helpful.

    Thanks

    #2
    Hello,

    You can find a multi series example within NinjaTrader by going to tools -> edit NinjaScript -> Strategy -> SampleMultiInstrument/TimeFrame

    If you haven't seen already this is a must read: http://www.ninjatrader.com/support/h...nstruments.htm

    We are also now offering premium education classes. The Intro To NinjaScript class here covers multi series scripts: http://www.ninjatrader.com/PremiumEducation.php

    When debugging I suggest using the output window (tools -> output window) and Print() statements to find out what lines are causing the issues.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Lance,

      Thanks for your response.

      I don't want to appear ungrateful, but first of all, I read the sections of the online manual 3 times before I posted my question. Second the example you referred to is very simple, it is no more help then the manual. Third, though I'm glad to see you're offering courses now, I have written dozens of indicators, but never one that used data from another instrument, so a course seems late at this point. As for the debugging tip, first I have to get it to compile and I haven't even got it to except the code yet.

      The real problem is that the error message doesn't make any sense, and I'm not even sure the problem relates to multi instrument. What I need is someone to tell me what could be giving me these crazy messages. I've posted the whole indicator. Hopefully that will help.
      Attached Files

      Comment


        #4
        Hello ECI-Ed,

        Thanks for your response and for the indicator file.

        Typically we do not do debugging for our clients, however, I had a chance to compile the script to see the error messages and a few things stood out immediately.

        First, I notice that you seem to be missing a "{" bracket or possibly you have an extra "}" bracket. From the way your code is indented I think its missing from after line 86.. "if (FirstTickOfBar)".

        Second, to use Array or ArrayList (these are not supported) you will need to use the system collections namespace.

        For example:
        #region Using declarations
        using System.Collections;


        Please let me know if this does not resolve your inquiry.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          That was just what I needed. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by chbruno, Today, 04:10 PM
          0 responses
          3 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          6 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frslvr, 04-11-2024, 07:26 AM
          9 responses
          127 views
          1 like
          Last Post caryc123  
          Working...
          X