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

Awesome oscillator background color

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

    Awesome oscillator background color

    Hi, long time reader, first time poster. Could someone point me in the right direction please. I want to paint the chart background different colors depending on whether the AO is printing green or red bars.

    I know how to paint the background if the bars are on either side of the 0 line, but I want the background to change solely based on whether the bars are red or green, irrespective of the side of 0 they are on...any thoughts? Thanks.

    90bideven

    #2
    Hello 90bideven,


    You could use BackColor to set the chart panel color for the current bar.
    Here is the BackColor Help Guide to assist you further.
    Here is an example of the AO code that colors the chart panel in response to if the AO is painting a Red or Green Bar.
    Code:
    [LEFT][FONT=Courier New][SIZE=2] [/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000FF]if[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2](Rising(AO))[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                        {     [/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000FF]if[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2](showpaintbars)[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                                    BarColor = Color.Green;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                              PlotColors[[/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]][[/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]] = Color.Green;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                              BackColor = Color.PaleGreen;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                        }[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                        [/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000FF]else[/COLOR][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                        {     [/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#0000FF]if[/COLOR][/SIZE][/FONT] [FONT=Courier New][SIZE=2](showpaintbars)[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                                    BarColor = Color.Red;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                              PlotColors[[/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]][[/SIZE][/FONT] [FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]] = Color.Red;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                              BackColor = Color.Salmon;[/SIZE][/FONT]
    [FONT=Courier New][SIZE=2]                        }[/SIZE][/FONT][FONT=Courier New][SIZE=2][/SIZE][/FONT]
    [/LEFT]
    Shawn B.NinjaTrader Customer Service

    Comment


      #3
      Great, thanks so much!

      90bideven

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gentlebenthebear, Today, 01:30 AM
      2 responses
      13 views
      0 likes
      Last Post gentlebenthebear  
      Started by Kaledus, Today, 01:29 PM
      2 responses
      8 views
      0 likes
      Last Post Kaledus
      by Kaledus
       
      Started by frankthearm, Yesterday, 09:08 AM
      13 responses
      45 views
      0 likes
      Last Post frankthearm  
      Started by PaulMohn, Today, 12:36 PM
      2 responses
      16 views
      0 likes
      Last Post PaulMohn  
      Started by Conceptzx, 10-11-2022, 06:38 AM
      2 responses
      56 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Working...
      X