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

coloring indicator based upon price parameters

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

    coloring indicator based upon price parameters

    I went through all of the tutorials and forum areas, but could not find an answer to the following:

    I can change the price bar colors with BarColor. I can change the backround color with BackColor or BackColorAll.

    Can I change the indicator bars based upon price action using a defined script, too?

    ie: I want to change the bars on an indicator's histogram based upon Close[0]>Close[1] of the price not the indicator's value.

    I cannot do: if { (Close[0]>Close[1]) IndicatorColor=Color.Blue;}
    nor can I do: IndicatorColor = Close[0]>Close[1] ? Color.Blue : Color.Red;

    This is probably a simple task and I'm missing something obvious here.

    Any help would be appreciated.

    Thanks.

    #2
    Take a look at this tutorial http://www.ninjatrader-support.com/H...tml?Overview25

    You need two separate plots to do the color change. You can also reference these indicators (http://www.ninjatrader-support.com/v...ead.php?t=2904) to get the results you want.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the help.

      As more indicators get published it will be easier to take bits and pieces off to customize.

      Comment


        #4
        Changing barcolor of Volume indicator histogram

        Originally posted by Josh View Post

        You need two separate plots to do the color change. You can also reference these indicators (http://www.ninjatrader-support.com/v...ead.php?t=2904) to get the results you want.
        Hi Josh,

        I assume from your post that your answer above may provide my solution also. I want to have the color in the Volume indicator histogram match the barcolor in the primary panel. I tried Pen.Color = new Pen.Color ...etc....but that changes the color of the entire histogram instead of just the current bar. Is there a simple way to do this or do I also need two separate plots? Even better, is such an indicator already out there I can access?

        Thanks

        Scott

        Comment


          #5
          Unfortunately the only way I know of is to use two separate plots at the moment. What you would do is when it is suppose to be green have Plot A take the volume and when it is suppose to be red have Plot B take the value of the volume. This way the plots will alternate on and off and you will get the coloring scheme you wanted.

          Edit: I've been meaning to throw this indicator together for awhile now so I just did it real quickly. I just used the default NinjaTrader chart colors for up/down bars because I was too lazy to program it dynamically. Hope this helps as reference code for future needs.
          Attached Files
          Last edited by NinjaTrader_JoshP; 08-23-2007, 10:24 PM.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks a lot Josh. Saved me a lot of work. I really appreciate it.

            Scott

            Comment


              #7
              Originally posted by Josh View Post
              Unfortunately the only way I know of is to use two separate plots at the moment. What you would do is when it is suppose to be green have Plot A take the volume and when it is suppose to be red have Plot B take the value of the volume. This way the plots will alternate on and off and you will get the coloring scheme you wanted.
              Doing that you have two indicators showing up in data box, PlotA and PlotB. Can I have one of them hidden from in Data Box? Because you really only have one indicator here. In the example of AC, you have AC, AC(Negative), AC(Postitive), but really ony AC is what you interested in seeing in data box.

              Hope someone can answer this question.

              I know I can create two plots: PlotA is green when value>0, PlotB is red when value<0, and setting plot.min, plot.max to switch. Each Add(..) will have to create a plot and a new entry in databox.

              What if I just do this in Variable setction:

              private Plot PlotB = new Plot(Color.Red,PlotStyle.Bar,"plotB");

              How or Can I use this PlotB to plot value when value<0?

              Appreciate any help.
              Last edited by gregiii; 08-26-2007, 04:40 PM.

              Comment


                #8
                Unfortunately, you can not limit what plots within an indicator is displayed in the DataBox.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Then how about doing this:

                  private Plot PlotB = new Plot(Color.Red,PlotStyle.Bar,"plotB");

                  How or Can I use this PlotB to plot value when value<0?

                  I am looking for ways to get around it.

                  Comment


                    #10
                    There is no way around.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      If you are just trying to be able to programmatically reference the value of the indicator, but can't do it because of the splitting of the value points into two plots what you could do is add a third plot that is a culmination of the two plots and just have it plot transparent. Alternatively you can use a DataSeries to collect all the indicator values and call the DataSeries instead of the two plots.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by terofs, Yesterday, 04:18 PM
                      1 response
                      21 views
                      0 likes
                      Last Post terofs
                      by terofs
                       
                      Started by CommonWhale, Today, 09:55 AM
                      1 response
                      3 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by Gerik, Today, 09:40 AM
                      2 responses
                      7 views
                      0 likes
                      Last Post Gerik
                      by Gerik
                       
                      Started by RookieTrader, Today, 09:37 AM
                      2 responses
                      12 views
                      0 likes
                      Last Post RookieTrader  
                      Started by alifarahani, Today, 09:40 AM
                      1 response
                      7 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Working...
                      X