Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using RGB color system in Add()

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

    Using RGB color system in Add()

    Hi guys

    Is it possible to use custom defined colors using the RGB system (as in 'Custom' in the 'Plots' box) using Add()?

    I now have:
    Code:
    Add(new Line(Color.Black, 30, "Line"));
    but instead of 'Black', I'd like to stipulate, say, (67,79,104) using the RGB system to define the color.

    I've tried a few ways to do this but they haven't compiled!

    Any advice will be much appreciated.

    #2
    Hello,

    You can use Color.FromArgb()

    Code:
    Add(new Line(Color.FromArgb(67,79,104), 30, "Line"));
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks as always, Matthew. That's exactly what I needed.

      Cheers.

      Comment


        #4
        You're welcome! You can even make colors/plots transparent using the Alpha overload with this method

        Code:
        //set the color to 50% transparency
        Add(new Line(Color.FromArgb(50, 67,79,104), 30, "Line"));
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thanks again, Matthew. This will really help me as I may soon have 20 or so horizontal lines crossing my charts with one of my strategies - and I'll need to be able to distinguish between them!

          Just to add that I've been fascinated to hear Raymond Deux (CEO of NinjaTrader) talk just now about NinjaTrader 8 on the Big Mike Trading Forum. It's going to be real fun using it!

          Comment


            #6
            Hi everyone again

            Rereading this thread, I realize some may chance upon it and have no idea what 'RGB' means in terms of color definition.

            This is from the beginning of the Wikipedia article



            on this subject:

            The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            596 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            343 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            556 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            554 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X