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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            81 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            64 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            66 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X