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

Volume bar color coding

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

    Volume bar color coding

    How can I get the volume bars painted different colors based on the volume of the bar? I would like say 3 values, where the lowest value would paint a green candle, in between the lowest and middle yellow, between the last 2 values orange and above the 3rd value red candle. Is that possible?

    #2
    Hello axjurado,

    For bars you can color them using an indicator.



    An indicator could process the bar information and color the bars based on your condition. To check the volume in a condition you can do that like the following:

    Code:
    if(Volume[0] > 0 && Volume[0] < 100)
    {
    
    }
    That would check for a range of volume between 0 and 100 You could repeat this type of condition to make the lowest/middle values you wanted. For the upper end value you can just use a greater than condition.

    Code:
    if(Volume[0] > 500)
    {
    
    }
    JesseNinjaTrader Customer Service

    Comment


      #3
      thanks i was able to make it work.

      Comment


        #4
        I need to create an indicator based on the current bar volume compared to the previous bar volume. Basically paint Bar 0 if volume Bar1 < 50% of volume Bar 0.

        Thank You, Jamie Stephens

        Comment


          #5
          Hello JamieHendrix,

          Please open a new thread for any new questions you have about your own script. If you are having difficulty making that type of condition please ensure to include that so we know what specifically you needed help with.

          To make a condition comparing volume between bars you would need to use BarsAgo. Every series has brackets at the end [0] which indicates the BarsAgo, 0 meaning the most recent bar. You would need a condition that compares the 0 bars ago volume against the 1 bars ago volume. Because you want to know 50% you also need to use some math there to divide the volume by 2 to get half its value.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ender_wiggum, Today, 09:50 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by rajendrasubedi2023, Today, 09:50 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by geotrades1, Today, 10:02 AM
          0 responses
          4 views
          0 likes
          Last Post geotrades1  
          Started by bmartz, Today, 09:30 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by geddyisodin, Today, 05:20 AM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X