• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Series<double> problems

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

    Series<double> problems

    method 1: declare Series<double> without AddPlot
    method 2: declare Series<double> using AddPlot and at #region Properties

    As shown on the code (saved from built-in CandleStickPattern indicator) below, both method 1 and method 2 provide the intended functions. However, for the method 1 implementation, if this indicator is loaded on a chart and saving the chart template ("Saved As Default"), the indicator properties are not saved in the Default chart template. Charts opened in subsequent new tabs will not load this indicator. Reloading the Default template does not resolve the problem. Saving the chart template to a different name does not resolve the problem.

    With the method 2 implementation, the indicator properties are saved in the Default (or other name) chart template. Charts opened in subsequent new tabs load this indicator correctly.

    Is the method 1 implementation wrong? Is there a way to declare a public Series<double> without using AddPlot?


    // method 1: declare Series without AddPlot
    public Series<double> Price_Hi;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionCandlestickPattern;
    Name = "kcCandleStickPattern";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DrawOnPricePanel = true;
    DisplayInDataBox = false;
    IsAutoScale = false;
    PaintPriceMarkers = false;
    TrendStrength = 4;
    Isignal_Validate = true;

    AddPlot(Brushes.Transparent, NinjaTrader.Custom.Resource.CandlestickPatternFoun d);

    // method 2: declare Series using AddPlot and at #region Properties
    AddPlot(Brushes.Transparent, "Price_Hi");

    // method 1: declare Series without AddPlot
    Price_Hi = new Series<double>(this, MaximumBarsLookBack.Infinite);
    }
    else if (State == State.Configure)
    {
    ... ;
    }
    else if (State == State.DataLoaded)
    {
    ... ;
    }
    }

    #2
    Hello,

    Thank you for the question.

    The correct way to add a Series<T> would be to make it private like the help guide example, but in the case you do need it public for something you would have to add [XmlIgnore] attribute. A series is not serializable so it will cause serialization problems being public. You likely are receiving errors upon trying to save the workspace in the log tab.

    To correct this and leave it public, you could use the following:

    Code:
    [XmlIgnore]
    public Series<double> Price_Hi;
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse,
      Thank you very much for your quick and accurate response. With your suggested method of declaration, the indicator properties are saved in the chart template correctly. Subsequent chart opened in the new tab also retain the same indicator properties as per saved chart template.

      While I was testing the above on the latest NT 8.0.4.0, I found that the resequencing of indicator panel is no longer functional. I tested it by deleting all workspace and chart template and populate the new chart with 4 NT built-in indicators, then open the indicator dialog and change the panel sequence by moving them up/down. The new sequence is shown and retained correctly on the dialog but the indicator panel sequence on the chart remained unchanged. On the same chart indicator dialog I was able to change the chart panel sequence by changing the panel number, except for panel 1, where the indicator just disappears.

      Comment


        #4
        Hello,

        If by moving the sequence up and down you mean you are pressing the Up or Down buttons to move the indicators sequence in the list of added items I believe what you are seeing would be expected.

        The up and down arrows should only change the order in the indicators list but not the panel. Not all indicators will apply to a new panel by default and the first in the list does not specifically signify it would be on the primary panel. The expected way to change the panel would be to use the Panel dropdown.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks for the confirmation.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ronaldgreene828, Today, 07:50 PM
          0 responses
          5 views
          0 likes
          Last Post ronaldgreene828  
          Started by nailz420, Yesterday, 08:38 AM
          2 responses
          12 views
          0 likes
          Last Post nailz420  
          Started by bouncetherubble, Today, 06:56 PM
          0 responses
          5 views
          0 likes
          Last Post bouncetherubble  
          Started by James108, Today, 06:09 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_EricB  
          Started by RandanAL, Today, 05:13 PM
          0 responses
          5 views
          0 likes
          Last Post RandanAL  
          Working...
          X