Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VOL indicator - bar colors

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

    VOL indicator - bar colors

    Has anyone customized the VOL indicator to allow for bar colors to be changed so that if the current bar is greater than the previous bar it can be one color, and if it is less than the previous bar it can be another color?

    #2
    Hello rsmtrade,

    This is pretty similar to the built in indicator VolomeUpDown. You can view code used for this by clicking Tools > Edit NinjaScript > Indicator > Select VolomeUpDown and click open.

    The color change here is based on Open compared to Close prices. You can save a copy and make modifications. Right Click > Save as > provide a new name and then make your changes.

    It might look something like this for comparisons to volume bars:

    Code:
     
    if (CurrentBar < 1) return;
     
    if (Vol()[0] > Vol()[1])
    {
    Values[0].Set(Volume[0]);
    Values[1].Reset();
    }
    else
    {
    Values[1].Set(Volume[0]);
    Values[0].Reset();
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I opened the VolUpDown and saved it with a new name. Then made some changes, but don't see it in the indicator list. What step might I have missed.

      Sorry for such basic questions, but I am not a coder!!

      Comment


        #4
        Once you give it a new name it should then be available under the indicators list.

        You may need to compile the indicator (Right click > Compile) after making any changes.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          i guess this is all over my head. now it tells me there is an error.. i have to add } to line 158, col 1. tried to do that but can't seem to figure it out. hmmpf..

          Comment


            #6
            Yeah, there can definitely be a bit of a learning curve initially. I would start at the link here and then work through the tutorials for custom indicator development. Tutorials are pretty basic and can get you up to speed on opening /closing brackets and the areas of code that you need to work in.



            I had already coded that indicator in my first reply so I've attached it in this post if you would like.

            You can delete what you have by clicking Tools > Edit NinjaScript > Indicator > highlight your indicator and click delete.

            To Import the one I attached:
            Download the attached file to your desktop
            2. From the Control Center window select the menu File > Utilities > Import NinjaScript
            3. Select the downloaded file
            Attached Files
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thank you! It does exactly what i wanted.

              Comment


                #8
                so if i could do the following...

                i have SMA of "typical" price plotting as a dash on the bar. can i have the dash be colored the same as the volume bar? up volume one color, down volume another color.

                Comment


                  #9
                  Yes, you would use the same principles as the first indicator and much of the same code.

                  See here for the reference sample on multi color plot indicators:


                  Code:
                   
                  if (CurrentBar < 1) return;
                  if (VOL()[0] < VOL()[1])
                  {
                  Values[0].Set(SMA(14)[0]);
                  Values[1].Reset();
                  }
                   
                  else
                  {
                  Values[1].Set(SMA(14)[0]);
                  Values[0].Reset();
                  }
                  Last edited by NinjaTrader_RyanM1; 08-24-2010, 02:26 PM.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Thank you! Got it working!

                    Was able to use the Sample you attached and modify it with your helpful code. Took a couple tries and tweaks, but now I have it doing what I need.

                    Again, Thanks.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by GussJ, 03-04-2020, 03:11 PM
                    16 responses
                    3,279 views
                    0 likes
                    Last Post Leafcutter  
                    Started by WHICKED, Today, 12:45 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post WHICKED
                    by WHICKED
                     
                    Started by Tim-c, Today, 02:10 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by Taddypole, Today, 02:47 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post Taddypole  
                    Started by chbruno, 04-24-2024, 04:10 PM
                    4 responses
                    51 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    Working...
                    X