zhaobong 发表于 2012-7-25 11:45:44

如何表达自定义的颜色?

比如这句代码:#property indicator_color1 Red   ,我想把其中的红色换成自定义的颜色,颜色从其他软件中取得,是RGB三个数字的那种,请问在mt4中如何定义这个颜色?

bull 发表于 2012-7-25 11:50:55

看MetaEditor帮助里的提示吧

Color constants can be represented in three ways: literally, by integers, or by name (for named Web colors only).

Literal representation consists of three parts representing numerical rate values of three main color components: red, green, blue. The constant starts with C and is enclosed in single quotes. Numerical rate values of a color component lie in the range from 0 to 255.

Integer-valued representation is written in a form of hexadecimal or a decimal number. A hexadecimal number looks like 0x00BBGGRR where RR is the rate of the red color component, GG - of the green one, and BB - of the blue one. Decimal constants are not directly reflected in RGB. They represent a decimal value of the hexadecimal integer representation.

Specific colors reflect the so-called Web colors set.

Examples:

// symbol constants
C'128,128,128'    // gray
C'0x00,0x00,0xFF' // blue
// named color
Red
Yellow
Black
// integer-valued representation
0xFFFFFF          // white
16777215          // white
0x008000          // green
32768             // green

Its internal representation is a long integer number of 4 bytes. The first byte will not be considered. The other three bytes contain RGB components.

页: [1]
查看完整版本: 如何表达自定义的颜色?