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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    87 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    106 views
    0 likes
    Last Post CarlTrading  
    Working...
    X