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 store a color in a variable?

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

    How to store a color in a variable?

    How can I store a color in a variable?

    Variable1 = Color.Red
    Varisble2 = Color.Blue

    thank you.

    #2
    Originally posted by Ironman9973 View Post
    How can I store a color in a variable?

    Variable1 = Color.Red
    Varisble2 = Color.Blue

    thank you.
    Just as you do for all variables. You declare it, and then you use it.
    Code:
    Color Variable1 = Color.Red;

    Comment


      #3
      Thank you. But I cannot use it like:

      Color.Variable1

      I would like to code an indicator where you can input the color of an arrow.

      variable1 = Red
      variable2 = Blue

      DrawArrowDown("tag1" + CurrentBar,true,0,High[0], Color.variable1);

      I hope that makes sense.

      Thank you.

      Comment


        #4
        Originally posted by Ironman9973 View Post
        Thank you. But I cannot use it like:

        Color.Variable1

        I would like to code an indicator where you can input the color of an arrow.

        variable1 = Red
        variable2 = Blue

        DrawArrowDown("tag1" + CurrentBar,true,0,High[0], Color.variable1);

        I hope that makes sense.

        Thank you.
        You need to read up on variables and how they are declared and used. If you have declared Variable1 as a color, why are you referring to it using object notation, as if the declared variable is a member of the Color class: it is an instance of it, not a member.

        Correct is:
        Code:
        Color Variable1 = Color.Red;
        //...
        DrawArrowDown("tag1" + CurrentBar,true,0,High[0], Variable1);

        Comment


          #5
          Thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by AveryFlynn, Today, 04:57 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Max238, Today, 01:28 AM
          4 responses
          37 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by r68cervera, Today, 05:29 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by geddyisodin, Today, 05:20 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by timko, Today, 06:45 AM
          2 responses
          14 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X