Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[0] Not Available ?

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

    Time[0] Not Available ?

    I have added a toolbar to a strat of mine. The strat has a parameter for the start time but I wanted to add a button to manually start the thing if I wish. I am getting an error the big "NT has detected an error and needs to shutdown...". I have pasted some of the trace.

    After debugging a little I have pretty much narrowed it down to the reference ToTime(Time[0]). I use this all over the place in OnBarUpdate() but I assume I am doing something wrong in this subroutine.

    privatevoid tsbtnStart_Click(object sender, EventArgs e)
    {
    if (ToTime(Time[0]) < dStartTime)
    {
    dStartTime = ToTime(Time[
    0]);
    tsbtnStart.ForeColor = Color.Red;
    DrawTextFixed(
    "tag1","Manually Started at " + dStartTime, TextPosition.Center);
    }
    else
    {
    DrawTextFixed(
    "tag1","Strat already running", TextPosition.Center);
    }
    }

    2010-07-02 13:21:04:515 in OnUnhandledThreadException
    2010-07-02 13:21:04:515 ********* exception trapped *********
    2010-07-02 13:21:04:515 Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    #2
    Hi netjms,

    Can you perhaps post your entire script so I can see how the handler is being used.
    TimNinjaTrader Customer Service

    Comment


      #3
      The script is more characters then allowed by the forum. Is there a way to attach the cs file to a post reply?

      Comment


        #4
        Hi netjms,

        Yes, you can attach the cs file of a zip file created at "File>Utilities>Export NinjaScript"
        TimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        192 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X