Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New Hour LINE Indicator

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

    New Hour LINE Indicator

    Hey guys, quick question why does this code Not work

    Code:
    //If Current Bar's Hour is Greater than Previous Bar's Hour, Draw New Line
    			if(Time[0].Hour > Time[1].Hour)
    			DrawVerticalLine("New Hour" + CurrentBar, 0, Color.Yellow, DashStyle.Dot, 2);

    #2
    Hello ginx10k,

    Thanks for your post.

    I suspect that unless you have a check for current bars that the indicator is likely erroring out when you run it. On the very first bar of data that the indicator will process the code would check the previous bar[1] when there is no previous bar. Adding: if(CurrentBar < 1) return; allows the code to run, see attached.

    Reference:
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    133 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    75 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    117 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    113 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    90 views
    0 likes
    Last Post CarlTrading  
    Working...
    X