Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot Reset

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

    Plot Reset

    I have this 2 lines of codes in onbarupdate.

    Code:
    Plot0.Reset();
    Print("Plot0: " + Plot0[0].ToString() + " Close:" + Close[0].ToString());
    now the Print comes out as

    Plot0: 5639.05 Close:5639.05
    Plot0: 5638.7 Close:5638.7
    Plot0: 5638.7 Close:5638.7
    Plot0: 5641.85 Close:5641.85
    Plot0: 5643 Close:5643
    Plot0: 5644.4 Close:5644.4
    Plot0: 5645.85 Close:5645.85
    Plot0: 5641.25 Close:5641.25
    Plot0: 5635.15 Close:5635.15
    Plot0: 5635.6 Close:5635.6
    Plot0: 5640.15 Close:5640.15
    pardon me if i sound too foolish but Reset is supposed to be null values, right. But it is printing out the close of the corresponding bar. am i missing something.

    thanks in advance.
    Attached Files

    #2
    bukkan, I will have someone get back to you on Monday.
    AustinNinjaTrader Customer Service

    Comment


      #3
      I think you need to use ContainsValue() check. Dont assume Reset stores null (it probably cant due to data type implementation). See Josh's example here http://www.ninjatrader.com/support/f...ad.php?t=33061

      Comment


        #4
        Originally posted by DaveE View Post
        I think you need to use ContainsValue() check. Dont assume Reset stores null (it probably cant due to data type implementation). See Josh's example here http://www.ninjatrader.com/support/f...ad.php?t=33061
        if i am not wrong but if one call the dataseries from a strategy then ContainsValue is not an option.

        Comment


          #5
          bukkan,

          DaveE is on the right track. Basically, the DataSeries holds a placeholder value and that value is the Close[0] price so that is why you are seeing identical prints. It would probably be easier to see the .Reset() effect if you had the DataSeries set to values other than close to begin with for testing purposes.

          As far as testing ContainsValue, you can and should do this in the strategy. For example:

          SMA(20).Value.ContainsValue(0);
          MACD(12, 9, 26).Avg.ContainsValue(0);
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Josh View Post
            bukkan,

            DaveE is on the right track. Basically, the DataSeries holds a placeholder value and that value is the Close[0] price so that is why you are seeing identical prints. It would probably be easier to see the .Reset() effect if you had the DataSeries set to values other than close to begin with for testing purposes.

            As far as testing ContainsValue, you can and should do this in the strategy. For example:

            SMA(20).Value.ContainsValue(0);
            MACD(12, 9, 26).Avg.ContainsValue(0);
            thanks for the clarification Josh and thanks to DaveE too.

            regards

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            626 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            359 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            562 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            567 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X