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 bortz, 11-06-2023, 08:04 AM
          47 responses
          1,611 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          22 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X