Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Bar out of valid range 0 through -1, was 0

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

    Bar out of valid range 0 through -1, was 0

    I got this error message, but cannot decypher the meaning of it.

    There is a strategy and an indicator communicating:
    The strategy calls a method of the indicator in order to place a mark on the chart (of course it is a bit more complicated than this, but the error is here), the point is, that the call for the method comes from outside, not from the OnBarUpdate method.

    Drawing horizontal line works fine, but drawing methods where I need to set "barsago" throw this error message.

    What the problem could be?

    #2
    A likely cause for the issue could be this: http://www.ninjatrader-support.com/v...ead.php?t=3170
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I am using 0. Which should be the current one. Explicit 0, not a variable.
      DrawVerticalLine("t",0,Color.Blue) or something like this.

      The point is to draw a sign on the indicator, when the strategy says so.

      Comment


        #4
        Not sure I follow. Indicators cannot take things from strategies. Strategies take signals from indicators. In your strategy when a certain something happens in an indicator you can then put in a DrawLine() or whatever you want directly from the strategy. I don't see why you would go back to an indicator to do that.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          The strategy places the orders, but I monitor and sometimes alter them by the chart trader, which cannot work with a strategy on the chart.
          Thats why I need an indicator on one chart, giving signals to the strategy on the other chart. All the visuals happen on the indicator chart though, with the engine running on the other chart.

          This works fine, the strategy can give values back to the indicator fine, only problem is that "barsago" doesn't work outside of the OnBarUpdate method in the indicator...

          (Probably I need a switch which activates on calling it from outside, which triggers something in OnBarUpDate method?)

          Comment


            #6
            Zapzap,

            Unfortunately this type of interaction is not supported. Trying to manually change a strategy's orders can have serious implications.

            What I would try is to use a try-catch block and find the exact line causing the error and working from there. Unfortunately I cannot provide any further guidance in this matter.
            Last edited by NinjaTrader_JoshP; 10-16-2008, 02:28 PM.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              There is nothing wrong with the manual change of the strategy's orders. I've written a complete order managing class for this, which working well.

              I am even past the try-catch blocks (these are native parts of every C# programs imho).

              The only problem left is:
              DrawVerticalLine(string tag, int barsAgo, Color color)

              applied outside of OnBarUpdate method:
              DrawVerticalLine("tag", 0, Color.Blue);

              giving an error:
              Bar out of valid range 0 through -1, was 0

              strange because of:
              valid range 0 through -1, was 0

              I admit this is not a conventional question, I asked it because it is not about the " cannot provide any further guidance in this matter" things part...


              Update: I could solve the problem by a workaround using the Update() method.

              Thanks for the very quick support though, I've nowhere seen such so far.
              Last edited by Zapzap; 10-17-2008, 01:13 AM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by llanqui, Today, 03:53 AM
              0 responses
              6 views
              0 likes
              Last Post llanqui
              by llanqui
               
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              10 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              15 views
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Yesterday, 08:42 PM
              0 responses
              11 views
              0 likes
              Last Post carnitron  
              Started by strategist007, Yesterday, 07:51 PM
              0 responses
              14 views
              0 likes
              Last Post strategist007  
              Working...
              X