Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change "Color for up bars" in indicator

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

    Change "Color for up bars" in indicator

    I have an indicator that changes BarColor based on certain criteria, and it works fine. I want to use Line on Close for Bar type, when I do, BarColor has no effect on that color. How can I access the "Color for up bars" (which does change the color) property to change the color in the indicator. I've searched the Ninja Script reference and did a search of the forums, with no luck. But, I could have missed it. Anyone know?

    #2
    Hi ghoti,

    Unfortunately, that is outside of the scope of support I can offer. Hopefully someone here will be able to provide some hints.

    As a workaround, you could simply create a plot connecting the close prices, then color the plot as you see fit from your code.
    Last edited by NinjaTrader_Tim; 07-29-2010, 01:34 PM.
    TimNinjaTrader Customer Service

    Comment


      #3
      If you want to set the color of something in your indicator to the same color as the Up or Down color of the price bar, use the ChartControl properties. ie: ChartControl.UpColor
      The following snippet lets you access the colors set by "Color for down bars" & "Color for up bars"

      Code:
      [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] (UsePriceColors) {[/SIZE][/FONT]
      [SIZE=2][FONT=Courier New]  colorVolUp = ChartControl.UpColor;[/FONT][/SIZE]
      [SIZE=2][FONT=Courier New]  colorVolDown = ChartControl.DownColor;[/FONT][/SIZE]
      [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
      [/SIZE][/FONT]
      It you only need to set your values once, It is possible to use this in the Initialize() method as well as the OnBarUpdate() & Plot() methods.

      enjoy
      Last edited by David Lean; 05-13-2011, 06:32 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      46 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      28 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      163 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      158 views
      2 likes
      Last Post CaptainJack  
      Working...
      X