Jump to content
Medved Trader Forums

SysColor? Custom Colors?


Recommended Posts

Trying to determine how I can specify in code the color of the paintbar? I can select the color manually in the Parameters box but I want to be able to control the color from within the code for testing purposes and customization of colors when different conditions are met within the same paintbar. For example, multiple IF conditions each with a separate color... In one of the paintbars I created I can see 0xFF9399FF set within SetColorAndShape but I'm unfamiliar with this number format can't investigate further.

Thanks


 
Edited by Jason
Link to comment
Share on other sites

There are three ways to specify a color.

1. Color.something - like Color.Black, Color.White, Color.Lime etc. - these are absolute colors.

2. SysColor.something - like SysColor.Positive, SysColor.Bid, SysColor.MainIndicator1 - these colors are taken from the current chart's color scheme.

3. the hex format.   0xFF9399FF - the first FF is transparency, just always leave it FF.  93 is the red component, 99 is green, FF is blue. So this color would be a bluish gray.  FF is max, so the 0xFF9399FF is a lightish blue.

See https://www.color-hex.com/ your 0xFF9399FF would be equivalent to #9399FF there.

Link to comment
Share on other sites

one more thing - note that you don't have to figure out the colors. We Have the Color INSERT button on the toolbar of the Advanced Editor. put the cursor in the code where you want the color code to go, click on the INSERT button for the color palette, select the color, done.

Link to comment
Share on other sites

Nice, thank you! The transparency component was throwing me off there. But I am having another problem. When I specify a color in code it does not have an effect. The colors seem to have a life of their own or are locked to whatever colors are selected by default or otherwise in the Parameters box. How can I reset them or make them subordinate to what I've in code? For example, I'm using this:

SetColorAndShape("INHAMMER", PBShape.Fill, Color.Purple );

TriggerAlert("test!", @"test.");

SetScanResult(@"test");

And the paintbar as drawn is showing up Red.

Link to comment
Share on other sites

When I try this after deleting the name parameter using:

SetColorAndShape(PBShape.Fill, Color.Purple );

I get 3 errors:

Pos    Code    Description    
29, 9    CS1502    The best overloaded method match for 'MT.Charting.PaintbarBase.SetColorAndShape(string, MT.Charting.PaintbarBase.PBShape, MT.Charting.PaintbarBase.SysColor)' has some invalid arguments    
29, 26    CS1503    Argument 1: cannot convert from 'MT.Charting.PaintbarBase.PBShape' to 'string'    
29, 40    CS1503    Argument 2: cannot convert from 'System.Drawing.Color' to 'MT.Charting.PaintbarBase.PBShape'    

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...