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

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 judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            57 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            20 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            9 views
            0 likes
            Last Post cre8able  
            Working...
            X