Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overlay = true && AutoScale = false in a multi-Time Frame indicator Cause an error

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

    Overlay = true && AutoScale = false in a multi-Time Frame indicator Cause an error

    In an indicator which uses a multi-Time Frame I was getting the following behavior:
    1. The indicator works properly on start-up, however,
    2. When closing the indicators pop-up dialog window with OK the indicator, does not draw and the “infamous” obscure error is generated:

      Error on plotting indicator 'AutoScale2Series'. Please check the 'OnBarUpdate' or the 'Plot' method: Index was outside the bounds of the array.
    3. Pressing F5 redraws the indicator correctly.
    4. The data series pop-up dialog closure does not cause any problems.

    It got very annoying so I used brute force deletions until I located the problem which is, in a multi-Time Frame indicator, setting
    Overlay = true;
    AutoScale = false;
    *** Note: to see the effect of changes in the code on the problem the indicator must be deleted and re-added in the Indicators Dialog. The three lines together must be present for the problem to appear.

    namespace NinjaTrader.Indicator
    {
    public class AutoScale2Series : Indicator
    {
    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange),
    PlotStyle.Line, "Plot0"));

    // Commenting any of the following three lines
    // makes the problem disappear
    Add(PeriodType.Minute, 1); /* Line 1 */
    Overlay = true; // default is false /* Line 2 */
    AutoScale = false; // default is true /* Line 3 */
    }

    protectedoverridevoid OnBarUpdate()
    {
    return;
    }

    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries Plot0
    {
    get { return Values[0]; }
    }
    }
    }

    My workaround is do delete AutoScale = false; which I can Live Without, However:


    1. Is this a bug or is this behavior by Design? I have added what I discovered on the behavior to facilitate locating the problem.
    2. This situation should motivate generating a more descriptive error than:

      Please check the 'OnBarUpdate' or the 'Plot' method: Index was outside the bounds of the array.

      Which in this dummy indicator'OnBarUpdate'
      has no code and the Plot is not overridden!!!!!

    Thanks and kind regards.

    #2
    Hello HKinani,

    Thank you for your post.

    This would not be expected behavior, I am testing your code on my end and I will follow up when I have further information.

    Comment


      #3
      Hello HKinani,

      Thank you for your patience.

      I am not seeing any issue with the code you provided. What are you setting the plot value to? Please provide the full code if possible.

      Comment


        #4
        Hi Patrick,

        I am running the latest 64-bit 7.0.1000.26 version.

        In the code above since nothing is plotted, the only effect is the generation of the errors in the log for each time the OK botton is pressed in the Indicators pop-up Dialog, as seen on the image attached.

        I am getting this effect with the indicator code supplied for AutoScale2Series


        Thanks
        Attached Files

        Comment


          #5
          HKinani,

          I too have tested this on my end and not receiving any errors from the outline you have provided.

          Can you try making a new indicator with a different name with the same code that you are attempting to use?
          Cal H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          602 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          22 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          20 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X