Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Script disables itself... why?

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

    Script disables itself... why?

    **NT** Error on calling 'OnOrderUpdate' method for strategy 'Single5Dyn1/6736c8d6ec5e4aac8055d2f44a8f6b48': More than 100 subsequent user events

    #2
    Hi greed999,

    You should look at how it is coded. NT is limiting what you are doing so that it doesn't crash. If you need to process more events than is allowed, please see this thread for a discussion and undocumented work around:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Is it possible to get close[0] for various instruments?

      I'm working with ZB and would like to get last price for ZT?

      Comment


        #4
        Yes, NinjaScript allows for multiple instruments and time frames in a single script. There is a sample you can work from built into all platforms. Tools > Edit NinjaScript > Strategy > SampleMultiInstrument. Documentation is available here:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Yep, I've just looked through this manual but can't figure out how can I access second instrument?
          Close[0] statnds for primary... in this case the second one can be accessed like this?
          Close[1][0]?

          Comment


            #6
            The secondary series is Closes[1][0]. Note the extra s.

            You can also contain in a BarsInProgress filter, which is used to define the context of bar updates.

            if (BarsInProgress == 1)
            {
            Print("This is the secondary series close: " + Close[0]);
            }
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              In this case my event handling procedure might look like this:

              protected override void OnBarUpdate()
              {
              if (BarsInProgress == 0)
              { My_First_Instrument_LastPrice=Close[0];}
              if (BarsInProgress == 1)
              { My_Second_Instrument_LastPrice=Close[0];}
              }

              And if I wouldn't want to split logic:
              protected override void OnBarUpdate()
              {
              My_First_Instrument_LastPrice=Close[0];
              My_Second_Instrument_LastPrice=Closes[1][0];
              }
              Last edited by greed999; 07-07-2011, 02:53 PM.

              Comment


                #8
                Yes, looks good. You can use BIP filter if you only need values from one series at a time, and that double indexed Closes[1][0] format when you need to work with both series at the same time.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by dmking, 11-12-2019, 12:31 PM
                4 responses
                4,139 views
                0 likes
                Last Post jasonw
                by jasonw
                 
                Started by roblogic, Today, 04:31 PM
                0 responses
                2 views
                0 likes
                Last Post roblogic  
                Started by morrnel, 05-12-2024, 06:07 PM
                4 responses
                52 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by xepher101, 05-10-2024, 12:19 PM
                6 responses
                69 views
                0 likes
                Last Post xepher101  
                Started by gbourque, Today, 04:11 PM
                0 responses
                1 view
                0 likes
                Last Post gbourque  
                Working...
                X