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

How to visualize a list of Ellipses with different colors

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

    How to visualize a list of Ellipses with different colors

    Hello,

    I am trying to visualize Ellipses with colors based on indicator values. For example the two ends of the spectrum are Red and Green. I want to fill Ellipses with colors like these:

    10% Red + 90% Green or 70% Red + 30% Green. Here percentages are based on indicator values.

    I attach a video and you can see that some Ellipses are filled with red or green color and then are repainted with yellow color, which is just 50% Red + 50% Green.

    I printed brushes just before RenderTarget.FillEllipse. The code is:

    Code:
    Print("OnRender, CurrentBar = " + CurrentBar + ", i = " + i + ", " + RenderTarget.ToString() + ", currentDXbrush.Color = " + currentDXbrush.Color.ToString());
    RenderTarget.FillEllipse(currentEllipse, currentDXbrush);
    The output shows that all brushes are different - some with more red and some with more green:

    OnRender, CurrentBar = 3079, i = 0, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:216 Green:47 Blue:0
    OnRender, CurrentBar = 3079, i = 1, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:215 Green:48 Blue:0
    OnRender, CurrentBar = 3079, i = 2, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:186 Green:109 Blue:0
    OnRender, CurrentBar = 3079, i = 3, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:217 Green:46 Blue:0
    OnRender, CurrentBar = 3079, i = 4, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:211 Green:55 Blue:0
    OnRender, CurrentBar = 3079, i = 5, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:179 Green:131 Blue:0
    OnRender, CurrentBar = 3079, i = 6, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:189 Green:101 Blue:0
    OnRender, CurrentBar = 3079, i = 7, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:185 Green:114 Blue:0
    OnRender, CurrentBar = 3079, i = 8, SharpDX.Direct2D1.WindowRenderTarget, currentDXbrush.Color = Alpha:0.5 Red:19 Green:136 Blue:0
    So Ellipses are filled with different colors and after that are repainted with yellow.

    How can I stop NinjaTrader from repainting Ellipses?

    Thanks,

    Valentin
    Attached Files
    Last edited by Valyo; 02-08-2017, 04:22 PM.

    #2
    The ARGB values for SharpDX colors must be of float type between 0 and 1, not byte type between 0 and 255. So, you need to divide your R, G and B values by 255f, just as you did for the Alpha values to get float values between 0.0f and 1.0f.

    Comment


      #3
      Yes, of course! Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by adeelshahzad, Today, 03:54 AM
      4 responses
      25 views
      0 likes
      Last Post adeelshahzad  
      Started by merzo, 06-25-2023, 02:19 AM
      10 responses
      823 views
      1 like
      Last Post NinjaTrader_ChristopherJ  
      Started by frankthearm, Today, 09:08 AM
      5 responses
      17 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      43 views
      0 likes
      Last Post jeronymite  
      Started by yertle, Today, 08:38 AM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X