Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy won't "Enable"

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

    Strategy won't "Enable"

    Hello

    I've been running an automated strategy across multiple markets for years and today, for the very first time, when I enable it, it works on all markets but not on CL 4-13. It shows "(D)" all along.
    I'm on on the latest Ninja version (11) and on Zen Fire.

    Any pointers would be much appreciated.

    Thanks


    Edit: The log shows the following error message: Error on calling "OnBarUpdate" method for Strategy xxx: You are accessing an index with a value that is invalid since its out of range.

    This makes no sense as the strategy is running on all other markets and always ran on CL without any issues.
    Last edited by laocoon; 02-22-2013, 02:19 AM.

    #2
    laocoon, you would unfortunately need to debug which part of your OnBarUpdate() calls are attempting to access the invalid index value. Which BarsRequired setting are you using here for the script? Are you familiar with C#'s Try/Catch to more specifically isolate which code part is giving rise to the issue?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply Bertrand. I'm afraid that there's not much I can do here as the code hasn't changed in months and was always working (still is this morning in all other markets). I'm not familiar with Try/Catch. What puzzles me the most is that the code is running fine in all other markets, with the exact same settings.

      The BarsRequired setting is 20.

      Thanks.

      Comment


        #4
        That could be the case, it would need to be understand via debugging why it ran into this issue today on the individual CL 04-13 chart you had open, could be a rarely triggered scenario perhaps in your situation. Have you also tried loading with more historical data available on the chart and perhaps a higher BarsRequird? Would you see the same outcome then?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          That's brilliant Bertrand, I just increased the "Days to Load" parameter in Data Series from 20 to 40 and it works....I still don't get it as it has always worked with 20 (and all other markets are set on 20 as well), but at least the issue is solved now.

          Thanks again for your help.

          Comment


            #6
            Originally posted by laocoon View Post
            That's brilliant Bertrand, I just increased the "Days to Load" parameter in Data Series from 20 to 40 and it works....I still don't get it as it has always worked with 20 (and all other markets are set on 20 as well), but at least the issue is solved now.

            Thanks again for your help.
            It is not quite solved. What happened is that you run into a rare boundary condition.

            You really do want to look at that code and correct it. It will be very inconvenient if that should happen again at some time in the future just when the strategy is on a roll producing winner after winner.

            Here is to hoping that it never happens again, but correct it anyway.

            Comment


              #7
              Thanks for your comment Koganam. You're right, it isn't really solved but I must admit that I'm too lazy to go through the entire code (it is quite extensive), as this is the first time in years that it happened and what's more, only in one market. I never had to debug my code as it always ran smoothly, so I hope I won't have to start doing it now. I like the "producing winner after winner" part of your post.....;-)

              Have a great weekend.

              Comment


                #8
                Guys,

                I hate to raise the subject again, but this morning the issue reappeared and increasing the Days to load or the Min. bas required didn't work. I'll readily admit that I have no idea how to debug a code as I never had to do it, but I also have a more general question about the logic behind it all: How can it be that my strategy is all of a sudden producing this error message *in only one market*?

                If a code is wrong it's wrong for all markets, not just one. And, what's more, how come that it starts behaving strange after having worked for years? This makes no sense to me.

                Thanks.

                EDIT: I just Decreased the Days to Load value to 10 and now it's working. This definitely makes no sense when considering the error message that says that there's an out of range value
                Last edited by laocoon; 02-25-2013, 02:46 AM.

                Comment


                  #9
                  laocoon, we could all speculate a lot and would not get closer though to the root reason why this is unfortunately seen in your script - I would suggest 'using' this market and setup to make the code even more stable by debugging out where the error is thrown in this admittingly rare scenario.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by laocoon View Post
                    Guys,

                    I hate to raise the subject again, but this morning the issue reappeared and increasing the Days to load or the Min. bas required didn't work. I'll readily admit that I have no idea how to debug a code as I never had to do it, but I also have a more general question about the logic behind it all: How can it be that my strategy is all of a sudden producing this error message *in only one market*?

                    If a code is wrong it's wrong for all markets, not just one. And, what's more, how come that it starts behaving strange after having worked for years? This makes no sense to me.

                    Thanks.

                    EDIT: I just Decreased the Days to Load value to 10 and now it's working. This definitely makes no sense when considering the error message that says that there's an out of range value
                    What you have just described is exactly what I meant when I said that you have a rare boundary condition triggering the issue. It is just that so far, only one market has reached that particular condition at this particular time.

                    Unfortunately the only option is to make the code more robust by debugging it. In fact, I am very surprised to read that you have written what you are describing as pretty complex and extensive code, and you never needed to debug it. I cannot remember that last time that I wrote useful code, that handled multiple asynchronous events, that worked right out of the chute. I envy your skills.

                    Comment


                      #11
                      Originally posted by koganam View Post
                      I cannot remember that last time that I wrote useful code, that handled multiple asynchronous events, that worked right out of the chute. I envy your skills.
                      You are way too kind Koganam and I certainly don't deserve your praise as I'm a total rookie when it comes to programming. I was lucky enough to get a framework for my strategy from a guy who knows what he's doing. I then added layers to it with my own conditions in order to make a complete strategy out of it. This approach has worked very well so far, as the code now is over 10'000 lines long and works like a charm (up until the below-mentioned issue appeared 3 days ago).

                      Thanks.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by WeyldFalcon, 12-10-2020, 06:48 PM
                      14 responses
                      1,426 views
                      0 likes
                      Last Post Handclap0241  
                      Started by Barry Milan, Today, 10:35 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post Barry Milan  
                      Started by DJ888, Yesterday, 06:09 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by jeronymite, 04-12-2024, 04:26 PM
                      3 responses
                      40 views
                      0 likes
                      Last Post jeronymite  
                      Started by bill2023, Today, 08:51 AM
                      2 responses
                      16 views
                      0 likes
                      Last Post bill2023  
                      Working...
                      X