Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 r68cervera, Today, 05:29 AM
      0 responses
      3 views
      0 likes
      Last Post r68cervera  
      Started by geddyisodin, Today, 05:20 AM
      0 responses
      6 views
      0 likes
      Last Post geddyisodin  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      6 responses
      35 views
      0 likes
      Last Post JonesJoker  
      Started by GussJ, 03-04-2020, 03:11 PM
      12 responses
      3,241 views
      0 likes
      Last Post Leafcutter  
      Started by AveryFlynn, Today, 04:57 AM
      0 responses
      7 views
      0 likes
      Last Post AveryFlynn  
      Working...
      X