Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unaccessible Plot Data

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

    Unaccessible Plot Data

    I'm trying to display values with the Market Analyzer from a custom written indicator, but not getting it to work.

    Here is a simplified indicator that illustrates the problem:

    Code:
    using System;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.ComponentModel;
    using System.Xml.Serialization;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    
    namespace NinjaTrader.Indicator
    {
        [Description("Test Market Analyzer")]
        [Gui.Design.DisplayName("Test_Market_Analyzer")]
        public class Test_Market_Analyzer : Indicator
        {
            private DataSeries disp_value;
    
            protected override void Initialize()
            {
                Add(new Plot(new Pen(Color.LimeGreen, 1.6F), PlotStyle.Dot, "TestMA"));
    
                disp_value = new DataSeries(this);
            }
    
            protected override void OnBarUpdate()
            {
                Values[0].Set( 3 );
                disp_value.Set( 5 );
            }
    
            [Browsable(false)]
            [XmlIgnore()]
            public DataSeries TestMA
            {
                get { return Values[0]; }
            }
    
            [Browsable(false)]
            [XmlIgnore()]
            public DataSeries Disp_Value
            {
                get { return disp_value; }
            }
        }
    }
    When I select the indicator as a Market Analyzer column, and select indicator plot "TestMA" all is well. When, instead, I select indicator plot "Disp_Value", nothing displays.

    Is there any reason why this should be the case?

    #2
    Try this and let me know if it makes a difference:

    Code:
            [Browsable(false)]
            [XmlIgnore()]
            public DataSeries Disp_Value
            {
                get 
               { 
                    Update();
                    return disp_value; 
               }
            }
    RayNinjaTrader Customer Service

    Comment


      #3
      If this does not work, I suspect the problem is that internally, OnBarUpdate() does not triggered for user defined data series that are not automatically added to Values collection through the Add() method when added into a MA column. Thus, if my suggestion does not work, you would have to add disp_value as by creating a Plot via Add().
      RayNinjaTrader Customer Service

      Comment


        #4
        When I add "Update()", it throws an exception when I try to select Disp_Value.

        Code:
        System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Test_Market_Analyzer.Update(): CurrentBar must be greater/equal 0 but was -1
           at NinjaTrader.Indicator.IndicatorBase.Update()
           at NinjaTrader.Indicator.Test_Market_Analyzer.get_Disp_Value()
           --- End of inner exception stack trace ---
           at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
           at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
           at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
           at NinjaTrader.MarketAnalyzer.IndicatorSeriesConverter.GetSeriesNames(IndicatorBase indicator)
           at NinjaTrader.MarketAnalyzer.IndicatorSeriesConverter.GetStandardValues(ITypeDescriptorContext context)
           at System.Windows.Forms.PropertyGridInternal.GridEntry.GetPropertyValueList()
           at System.Windows.Forms.PropertyGridInternal.PropertyGridView.PopupDialog(Int32 row)
           at System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnBtnClick(Object sender, EventArgs e)
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.PropertyGridInternal.DropDownButton.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.PropertyGridInternal.DropDownButton.OnMouseUp(MouseEventArgs e)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
        Attached Files

        Comment


          #5
          I guess you'll need to try Ray's suggestion for using a plot then.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Sorry, this is beyond of what we support. We only support access to regular plot series and not custom data series on the MA.

            Comment


              #7
              Thanks. Using "Add(new Plot( ... ))" works around the unhandled exception.

              Unfortunately it does not solve the problem that I'm really trying to solve.

              What I'm trying to do is to develop an indicator which displays certain values on a chart, but allows the display of different values in the Market Analyzer.

              When I the "Add" approach as a workaround, the values which get displayed cause the chart to display funny, because it starts auto-scaling. I changed the default color of this new plot to "transparent" but that doesn't help the autoscaling. I was able to change the Autoscale parameter and that fixes the display.

              However, I would like to request that plots with a color of "transparent" be excluded from autoscaling without having to change the setting which affects all of an indicator's plots.

              Also, if custom data series are not to be supported by the Market Analyzer, it would be best if they were not displayed in the drop-down selection under "Plot" in the market analyzer (although I'd vote for adding code to allow access to these data series rather than adding code to eliminate their display as possible selections.)

              Please add these items as something for development to look at when they have a few, free minutes.

              Comment


                #8
                Thanks KBJ for the suggestions. We'll put it on the list for future considerations.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  >> Also, if custom data series are not to be supported by the Market Analyzer, it would be best if they were not displayed in the drop-down selection under "Plot" in the market analyzer (although I'd vote for adding code to allow access to these data series rather than adding code to eliminate their display as possible selections.)

                  I was not able able to reproduce your crash below. Please post a simple as possible and reproducible scenario. Thanks

                  Comment


                    #10
                    >> However, I would like to request that plots with a color of "transparent" be excluded from autoscaling without having to change the setting which affects all of an indicator's plots.

                    Already implemented with NT6.5

                    Comment


                      #11
                      Thanks for adding the no-auto-scaling feature for transparent plots.

                      The unhandled exception seems to be repeatable. I exited and restarted NinjaTrader 6.0.1000.7 and then immediately after connecting to the ZenFire & Gain data feeds, tried to add my test indicator to the Market Analyzer columns.

                      Here is the indicator code (also attached in zip file):

                      Code:
                      using System;
                      using System.Diagnostics;
                      using System.Drawing;
                      using System.Drawing.Drawing2D;
                      using System.ComponentModel;
                      using System.Xml.Serialization;
                      using NinjaTrader.Data;
                      using NinjaTrader.Gui.Chart;
                      
                      namespace NinjaTrader.Indicator
                      {
                          [Description("Test Market Analyzer")]
                          [Gui.Design.DisplayName("Test_Market_Analyzer2")]
                          public class Test_Market_Analyzer2 : Indicator
                          {
                              private DataSeries disp_value;
                      
                              protected override void Initialize()
                              {
                                  Add(new Plot(new Pen(Color.LimeGreen, 1.6F), PlotStyle.Dot, "TestMA"));
                      
                                  disp_value = new DataSeries(this);
                              }
                      
                              protected override void OnBarUpdate()
                              {
                                  Values[0].Set( 3 );
                                  Disp_Value.Set( 5 );
                              }
                      
                              [Browsable(false)]
                              [XmlIgnore()]
                              public DataSeries TestMA
                              {
                                  get { return Values[0]; }
                              }
                      
                              [Browsable(false)]
                              [XmlIgnore()]
                              public DataSeries Disp_Value
                              {
                                  get { 
                                        Update(); 
                                        return disp_value;
                                      }
                              }
                          }
                      }
                      The first thing I notice is that when I attempt to select the Test_Market_Analyser2 indicator, it never displays any of the correct Plot values, but instead continues displaying the prior Plot value from the default ADL indicator (see 1st screen clip).

                      Then when I attempt to change the plot, it gives me the unhandled exception (see 2nd screen clip, and full details same as in prior post.)
                      Attached Files
                      Last edited by KBJ; 12-21-2007, 11:14 AM.

                      Comment


                        #12
                        Misunderstanding: Is this reproducible on NT6.5? For sure we will not change anything there on NT6. Thanks

                        Comment


                          #13
                          Dierk, I wouldn't expect you to be fixing this in 6.0 (nor in 5.2 for that matter).

                          It doesn't get the unhandled exception in 6.5, it just displays a blank column (no data - even with the "Update()" call added to the property getter, as in my most recent posted example).

                          If this can be made to work, I think it would greatly extend the flexibility and usefulness of the Market Analyzer.

                          Comment


                            #14
                            >> It doesn't get the unhandled exception in 6.5, it just displays a blank column
                            Correct, this is expected behavior. We'll see what we can do to change the design. Thanks for your suggestion.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by aa731, Today, 02:54 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post aa731
                            by aa731
                             
                            Started by thanajo, 05-04-2021, 02:11 AM
                            3 responses
                            470 views
                            0 likes
                            Last Post tradingnasdaqprueba  
                            Started by Christopher_R, Today, 12:29 AM
                            0 responses
                            10 views
                            0 likes
                            Last Post Christopher_R  
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            166 responses
                            2,237 views
                            0 likes
                            Last Post sidlercom80  
                            Started by thread, Yesterday, 11:58 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post thread
                            by thread
                             
                            Working...
                            X