Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Bar Color in Ninja Script

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

    Changing Bar Color in Ninja Script

    Hi,

    Can anyone tell me how to change the color of the current bar and leave the historicals as is. I'm trying to create a ninja script that changes the first and subsequent bars to a different color once they pass regular market hours. Then in the morning to change the bars back to the original color so I can easily distinquish between the start and end times of the regular market hours as opposed to nonregular hours.

    Thanks to anyone who can help.
    Johnny.

    #2
    resubmitted under proper forum

    Sorry.

    I resubmitted this question under the correct forum.

    regards
    Johnny

    Comment


      #3
      Hi Spartacus,

      You can add something like this to the end of OnBarUpdate()

      if (Historical)
      return;

      if (ToTime(Time[0]) >= ToTime(7, 30, 00) && ToTime(Time[0]) <= ToTime(2, 15, 00))
      {
      BarColor = Color.Magenta;
      }
      TimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      144 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      70 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      125 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      78 views
      0 likes
      Last Post PaulMohn  
      Working...
      X