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

change the transparency of the color using the volume filter

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

    change the transparency of the color using the volume filter

    Hello everyone,
    There is a task to change the transparency of the color using the volume filter

    the code

    Code:
    [B]if (Volume >=1000)[/B]
    {
    
    Brush newBrush = Brushes.Green.Clone();
    [B]newBrush.Opacity = 0.2;[/B]
    
    BarBrushes[0] = newBrush;
    }
    a task:

    If the volume is equal to the minimum = transparency 0.2 (Min)

    if the volume is 2 x times greater than the = transparency 0.9 (Max)


    It is necessary for the transparency to change itself in the min-max range, depending on the volume

    what is the easiest way to implement this?

    please with an example with syntax
    Thanks in advance!

    #2
    Hello memonolog,
    Having if else conditions for all rules to change transparency is good, you should define all conditions. In terms of syntax you're missing newBrush.Freeze(); add it to avoid any surprises. Be sure to define Brushes in State.Configure. I believe you've defined Volume, it must be invoked before you can use it. Having all conditions for both Up Bar & Down Bar will be a good idea to avoid any confusions. Hope it helps!

    Comment


      #3
      Hello memonolog,

      s.kinra, thank you for the helpful input. This is correct to use newBrush.Freeze(). Volume I would expect to be Volume[0] as you would like the current bar's value of the Volume series.


      The code you have appears to be the easiest way to implement this. Is the behavior not as you expect?
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by geddyisodin, Today, 05:20 AM
      0 responses
      3 views
      0 likes
      Last Post geddyisodin  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      6 responses
      33 views
      0 likes
      Last Post JonesJoker  
      Started by GussJ, 03-04-2020, 03:11 PM
      12 responses
      3,239 views
      0 likes
      Last Post Leafcutter  
      Started by AveryFlynn, Today, 04:57 AM
      0 responses
      6 views
      0 likes
      Last Post AveryFlynn  
      Started by RubenCazorla, 08-30-2022, 06:36 AM
      3 responses
      79 views
      0 likes
      Last Post PaulMohn  
      Working...
      X