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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            164 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            318 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            246 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            350 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X