Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reset() Question

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

    Reset() Question

    HI,

    I am having an issue with the Reset() method. I have the following code:

    In Initialize():
    Add(new Plot(Color.Cyan, PlotStyle.Dot, "TDown"));
    Add(
    new Plot(Color.Blue, PlotStyle.Dot, "TUp"));
    Plots[
    0].Pen = new Pen(Color.Cyan, 6);
    Plots[
    1].Pen = new Pen(Color.Red, 6);

    In OnBarUpdate():
    if(CurrentBar < 10)
    {
    TDown.Reset(); // sets null value for plotting purposes but 0 value for mathematical purposes
    TUp.Reset();
    ...
    }

    When I print values of TDown[0] or TUp[0] I get actual price values - the Close value of the bar. I expected to see null, or zero values or NaN. I must be using Reset() incorrectly because my output does not agree with the documentation. Any suggestions?

    Thank you for any help you may be able to provide.

    Last edited by Zeos6; 06-11-2011, 05:46 PM.

    #2
    Zeos6, I will have someone get back to you tomorrow.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by Zeos6 View Post
      HI,

      I am having an issue with the Reset() method. I have the following code:

      In Initialize():
      Add(new Plot(Color.Cyan, PlotStyle.Dot, "TDown"));
      Add(
      new Plot(Color.Blue, PlotStyle.Dot, "TUp"));
      Plots[
      0].Pen = new Pen(Color.Cyan, 6);
      Plots[
      1].Pen = new Pen(Color.Red, 6);

      In OnBarUpdate():
      if(CurrentBar < 10)
      {
      TDown.Reset(); // sets null value for plotting purposes but 0 value for mathematical purposes
      TUp.Reset();
      ...
      }

      When I print values of TDown[0] or TUp[0] I get actual price values - the Close value of the bar. I expected to see null, or zero values or NaN. I must be using Reset() incorrectly because my output does not agree with the documentation. Any suggestions?

      Thank you for any help you may be able to provide.

      The point may be moot, as that code seems to indicate that you are pretty much otherwise doing nothing if (CurrentBar < 10), at which point, as you have done nothing, I believe Plots are, bu default, set to the Close value for the bar, but not plotted.

      You can always force the value to zero, before you reset, thus:

      Code:
      TDown.Set(0);
      TDown.Reset();
      You might want to check if those values are even a valid plot. ref: http://www.ninjatrader.com/support/h...dataseries.htm

      Comment


        #4
        Hi Koganam,

        Thanks for your reply. I was actually wondering about that over the weekend. It appears that you actually need to set a value before you can reset it - even though a default value is already in place. Seems odd since a default value of bar close already exists there but I will give it a go.

        On another note, the code snippet with CurrentBar < 10 is contrived and artificial. I simply wanted to check what values were being reset in the plot.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        637 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X