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 a variable to supply a color to DrawRegion

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

    Using a variable to supply a color to DrawRegion

    I would like my DrawRegion to change color based on a set of criteria, so I created a variable to hold the color I want:

    string HighFillColor = "Color.LightGray";

    However I get a compile error using this variable in my DrawRegion:


    DrawRegion(FillCounter.ToString()+"FillTag",HighCounter,0,ROCPlot,HighLineValue[0],HighFillColor,HighFillColor,3);

    I have tried setting HighFillColor to just "LightGray" and that doesn't complie.

    I have also tried System.Drawing.Color(HighFillColor) and that didn't work either.

    What is the correct syntax for setting a color using a variable in DrawRegion?

    Thanks.

    #2
    Originally posted by Grasul View Post
    I would like my DrawRegion to change color based on a set of criteria, so I created a variable to hold the color I want:

    string HighFillColor = "Color.LightGray";

    However I get a compile error using this variable in my DrawRegion:


    DrawRegion(FillCounter.ToString()+"FillTag",HighCounter,0,ROCPlot,HighLineValue[0],HighFillColor,HighFillColor,3);

    I have tried setting HighFillColor to just "LightGray" and that doesn't complie.

    I have also tried System.Drawing.Color(HighFillColor) and that didn't work either.


    What is the correct syntax for setting a color using a variable in DrawRegion?

    Thanks.
    Hi Grasul, what newfangled stuff has Osi come up with on TTW recently?

    On to your question, your code will not compile because color is not a string. You could convert it with a parser, but much simpler is to declare it as a color in the first place thus:
    Code:
    Color HighFillColor = Color.LightGray;
    Last edited by koganam; 09-21-2011, 06:17 PM.

    Comment


      #3
      Thank you very much.

      Come by and check, Osi seems to be getting into his typical amount of trouble..

      And btw, a pox on computer languages where Capitalization matters for syntax. I have enough trouble with spelling.
      Last edited by Grasul; 09-21-2011, 06:26 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Tim-c, Today, 03:54 AM
      0 responses
      3 views
      0 likes
      Last Post Tim-c
      by Tim-c
       
      Started by FrancisMorro, Today, 03:24 AM
      0 responses
      2 views
      0 likes
      Last Post FrancisMorro  
      Started by Segwin, 05-07-2018, 02:15 PM
      10 responses
      1,770 views
      0 likes
      Last Post Leafcutter  
      Started by Rapine Heihei, 04-23-2024, 07:51 PM
      2 responses
      31 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by Shansen, 08-30-2019, 10:18 PM
      24 responses
      945 views
      0 likes
      Last Post spwizard  
      Working...
      X