Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetBar throws error

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

    GetBar throws error

    In this code block:

    Code:
     
    [COLOR=red]StudyBar = GetBar(Time[0].AddMinutes(-30));[/COLOR]
    [FONT=Courier New][SIZE=2][SIZE=2][FONT=Courier New]Print(StudyBar);[/FONT][/SIZE]
    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (StudyBar == [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
    [/SIZE][/FONT]
    I get an "Object reference not set to an instance of the object" thrown by the line in "Red".

    This script errs when Time[0] = 9:04. There is a Bar at 8:34.

    Further investigation shows that this is the first Time[0] that is an even Seconds (9:04:00) I think perhaps that is the problem, but I can't understand why?

    Ran it again and time[0] was 9:04:01!

    I am at a total loss... Please help!
    Last edited by Sleeping Troll; 04-18-2010, 08:35 AM. Reason: Even Further investigation

    #2
    Sleeping Troll, please keep all discussion for the same topic on the same thread. Perhaps we can test this on our end. Which instrument are you using and what time frame?
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X