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 rtwave, 04-12-2024, 09:30 AM
        2 responses
        20 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Started by tsantospinto, 04-12-2024, 07:04 PM
        5 responses
        67 views
        0 likes
        Last Post tsantospinto  
        Started by cre8able, Today, 03:20 PM
        0 responses
        6 views
        0 likes
        Last Post cre8able  
        Started by Fran888, 02-16-2024, 10:48 AM
        3 responses
        49 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by martin70, 03-24-2023, 04:58 AM
        15 responses
        115 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X