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

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 inanazsocial, Today, 01:15 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by rocketman7, Today, 02:12 AM
      0 responses
      10 views
      0 likes
      Last Post rocketman7  
      Started by dustydbayer, Today, 01:59 AM
      0 responses
      1 view
      0 likes
      Last Post dustydbayer  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      5 responses
      23 views
      0 likes
      Last Post trilliantrader  
      Started by Davidtowleii, Today, 12:15 AM
      0 responses
      3 views
      0 likes
      Last Post Davidtowleii  
      Working...
      X