Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bug in Indicator Color Bars

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

    Bug in Indicator Color Bars

    There is an issue with an indicator I am developing to colour the volume bars, in which no bars are plotted for the indicator if I compare a current value to a historic value. When this occurs, the indicator panel just shows the background colour and the data panel shows the plot names for the indicator, but no values.

    This problem does not occur on a 15 minute chart, but it does on a daily chart.


    The issue can be reproduced by compiling a new indicator, which is an exact copy of the code from the built in indicator VolumeUpDown, with each occurrence of the string VolumeUpDown renamed to VolumeTest.

    In VolumeTest, change line 41 to

    if (Close[0] >= Close[1])

    In VolumeUpDown, the same line number reads

    if (Close[0] >= Open[0]).

    If I change line 41 to read the same as the line in VolumeUpDown the bars plot OK, which confirms that the rest of the code is OK.

    Is this is bug or am I doing things in the wrong way?



    Windows 7 64 bit, up to date with patches
    NT version 7.0.1000.10
    .NET/CLR Version: 2.0.50727.5456

    #2
    Hello,

    Are you getting any errors on the log tab of the Control Center?

    You're likely running into an issue explained in the following forum post from our Tips section:


    Please try adding the following snippet to the beginning of your code in OnBarUpdate()

    Code:
    if (CurrentBar < 1)
    return;
    You need to ensure you have enough bars on the chart to calculate correctly.
    MatthewNinjaTrader Product Management

    Comment


      #3
      That does fix the problem. Many thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      161 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      310 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      349 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X