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

Multi Instrument not woking in NT 7.0.1000.40

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

    Multi Instrument not woking in NT 7.0.1000.40

    I had this example indicator working perfectly in a previous version of NT, but when I updated to version 7.0.1000.40 it stopped working.
    Any clues?

    protected override void Initialize()
    {
    Add("ES 06-19", PeriodType.Tick, 610);
    Add("NQ 06-19", PeriodType.Tick, 337);
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    Overlay = false;
    }

    protected override void OnBarUpdate()
    {
    ES=BarsArray[1][0];
    NQ=BarsArray[2][0];
    Plot0.Set(ES-NQ);
    }

    #2
    Hello Capablanca,

    Thanks for your post.

    Do you see any error messages in the "log" tab of the control center when you apply the indicator?

    Your code example does not show you checking to make sure that you have bars available before starting to plot/calculate. Typically this would be done by checking the CurrentBars[n] where [n] is the related BarsArray. The chart Bars would be [0], ES 06-19 would be [1] and NQ 06-19 would be [2] so that the top of OnBarUpdate() I would expect to see a check like:

    if (CurrentBars[0] < 1 || CurrentBars[1] < 1 || CurrentBars [2] < 1) return; // do not process until we have at least one bar of each
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Indeed that was my error.
      I hadn't used that bars count in my previous indicators and for some reason they had worked.

      Thank you for the support.

      Comment


        #4
        Hello,
        I want to post my question here as its referring to this topic in NT7.
        I add in Initialize the instruments as here in #1 with Add("NQ 06-19", PeriodType.Minute, 1); Add("YM 06-19", PeriodType.Minute, 1); Add("CL 07-19", PeriodType.Minute, 1);Add("GC 08-19", PeriodType.Minute, 1);
        and in onbarupdate I have
        EnterShort(1, 1, "NQShort");
        EnterShort(2, 1, "YMShort");
        EnterShort(3, 1, "CLShort");
        EnterLong(4, 1, "GCLong");

        but it only enters NQ and GC.

        //I have EntriesPerDirection = 4; EntryHandling = EntryHandling.AllEntries

        Why doesnt the script entershort YM and CL?

        Thank you!
        Tony
        Last edited by tonynt; 06-11-2019, 03:51 AM. Reason: translation error

        Comment


          #5
          Hello tonynt,

          Thanks for your post.

          You also wrote in to Platformsupport on the very same question which we prefer that you either post in the forum or write in but not both as this creates twice the work for the same answer.

          Testing on my end you would want to set EntriesPerDirection to 1 and EntryHandling to UniqueEntries as this uses the signal names.
          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          2 views
          0 likes
          Last Post jaybedreamin  
          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  
          Working...
          X