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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            81 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            64 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            68 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            55 views
            0 likes
            Last Post CarlTrading  
            Working...
            X