Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnBarUpdate' method on bar 0.

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

    #16
    @s.kinra

    Thank you, all now is working as supposed to!

    Comment


      #17
      Errors were:

      1) Not setting "private Series<int> test;" before OnStateChange
      2) not setting "test = new Series<int>(this);" in State.Configure

      But now all works well, thank you s.kinra

      Comment


        #18
        This is how we initiate new variable data series without a plot for it, so it can be used for calculations.
        Glad to know it works!
        Last edited by s.kinra; 10-12-2020, 02:17 AM.

        Comment


          #19
          However. If I try calling Custom201010()[0] in a strategy, it gives Error on calling 'OnBarUpdate' method on bar 20: Index was outside the bounds of the array. error.

          My strategy starts with bar 20. How can this be solved?

          Comment


            #20
            If you need to use indicator in strategy you must define a plot in indicator so then this plot can be used in strategy. You can keep it transparent.

            Comment


              #21
              can you share a code of it?

              Comment


                #22
                Custom201010.zip
                Here you get it!

                Comment


                  #23
                  Thanks, now it works like a charm both as indicator and in strategy.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NTEducationTeam, Today, 01:49 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post NTEducationTeam  
                  Started by NTEducationTeam, Today, 01:24 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post NTEducationTeam  
                  Started by saltminer, 07-07-2025, 01:43 PM
                  1 response
                  112 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by idude, 07-08-2025, 05:06 AM
                  0 responses
                  49 views
                  0 likes
                  Last Post idude
                  by idude
                   
                  Started by music_p13, 07-05-2025, 11:33 PM
                  1 response
                  53 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X