Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

System.IndexOutOfRangeException get_TickSize()

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

    System.IndexOutOfRangeException get_TickSize()

    Hi, I have written the following method:

    Code:
    private double GetTickSizeValue()
    {
      double ticksizevalue = 0.0;
    
      try
      {
        ticksizevalue = Instrument.MasterInstrument.PointValue * (1 * TickSize);
      }
      catch (Exception ex)
      {
         string errorMsg = string.Format("GetTickSizeValue() {0}", ex.ToString());
         Debug.Print(errorMsg);
         Print(errorMsg);
         Log(errorMsg, LogLevel.Error);
       }
       return ticksizevalue;
    }
    i now get this error message at irregular intervals:

    GetTickSizeValue() System.IndexOutOfRangeException: The index was out of the array range.
    at NinjaTrader.NinjaScript.NinjaScriptBase.get_TickSi ze()
    at NinjaTrader.NinjaScript.Strategies.SidiUnmanaged.G etTickSizeValue()

    can someone maybe give me a tipp what to look for?

    #2
    Hello sidlercom80,

    Thanks for your post.

    Can you provide further detail so I can replicate the error?

    Where/when are you calling the method from?

    What instruments have you tested this on?

    What data feed do you connect to?

    What specific version of NinjaTrader8 are you using? (look under help>about)

    Is there a particular sequence of steps to create a repeatable error?


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi _PaulH

      Version: 8.0.23.2 64-bit, tested and found on NQ 12-20 replay mode until now, Datafeed: CQG

      The error occurs without a specific initial situation, just sometime when my strategy is up and running, the method is called from different locations in my script.
      this will probably be a basic programming error on my part, but i don't know where to start the search;-)
      I am still testing in live sim mode now, I will also be happy to report here as soon as the error also occurs here.

      Comment


        #4
        Hello sidlercom80,

        Thanks for your reply.

        I would suggest adding a print before each call to the method.

        If and when the error occurs the last print should point to the last section that called and from there you can debug further.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello _PaulH, I also noticed the following error during testing:

          Code:
          DisplayItemsChartWindowBottom() System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs.
          bei NinjaTrader.NinjaScript.DrawingTools.DrawingTool.S etDrawingToolCommonValues(IDrawingTool tool, String tag, Boolean isAutoScale, NinjaScriptBase ownerNinjaScript, Boolean isGlobal)
          bei NinjaTrader.NinjaScript.DrawingTools.Draw.TextFixe dCore(NinjaScriptBase owner, String tag, String text, TextPosition textPosition, Brush textBrush, SimpleFont font, Brush outlineBrush, Brush areaBrush, Nullable`1 areaOpacity, Boolean isGlobal, String templateName, DashStyleHelper outlineDashStyle, Int32 outlineWidth)
          bei NinjaTrader.NinjaScript.Strategies.SidiUnmanaged.DisplayItemsChartWindowBottom()
          Code:
          [Range(0, 100)]
          [Display(ResourceType = typeof(Custom.Resource), Name = "Area Opacity %", Description = "Select opacity to display on chart", Order = 4, GroupName = "ChartWindow Text PnL")]
          public int PnlAreaOpacity { get; set; }
          this is only an integer value, what is wrong here?
          Attached Files

          Comment


            #6
            Hello sidlercom80,

            Thanks for your reply.

            Regarding this forum topic of System.IndexOutOfRangeException get_TickSize(), I would suggest calling it once in State.DataLoaded and assign the value to a class-level variable to then use that throughout.

            Your latest post was a bit confusing as it is not related to the topic. Going forward I would suggest a new topic when the subject has changed. This helps us keep the forum organized for searching.

            As a test, I would suggest replacing the opacity variable with an actual integer value and test again. Assuming the error continues we would suggest whatever you are doing with DisplayItemsChartWindowBottom should be done using TriggerCustomEvent(): reference: https://ninjatrader.com/support/help...ustomevent.htm
            Last edited by NinjaTrader_PaulH; 01-18-2021, 09:46 AM. Reason: Removed misplaced duplicate link
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hi NinjaTrader_PaulH , Thanks for the tip with TriggerCustomEvent(), that helped me ;-)

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by soon123, 03-05-2021, 10:15 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by soon123, 03-05-2021, 09:48 PM
              2 responses
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Amaria77, 03-05-2021, 08:21 PM
              2 responses
              12 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by jleira, 03-05-2021, 07:08 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by sgordet, Today, 05:03 PM
              0 responses
              3 views
              0 likes
              Last Post sgordet
              by sgordet
               
              Working...
              X