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 ZenCortexCLICK, Today, 04:58 AM
                0 responses
                5 views
                0 likes
                Last Post ZenCortexCLICK  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                172 responses
                2,281 views
                0 likes
                Last Post sidlercom80  
                Started by Irukandji, Yesterday, 02:53 AM
                2 responses
                18 views
                0 likes
                Last Post Irukandji  
                Started by adeelshahzad, Today, 03:54 AM
                0 responses
                8 views
                0 likes
                Last Post adeelshahzad  
                Started by Barry Milan, Yesterday, 10:35 PM
                3 responses
                13 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X