CandlestickChart

CandlestickChart ( appearanceConst ;​ itemGap ;​ highTickMarkLength ;​ highTickMarkAlignment ;​ lowTickMarkLength ;​ lowTickMarkAlignment )

Argument Type Range Default Note
appearanceConst int 0..127 default
itemGap num 0..1000000 100 In % of box width
highTickMarkLength num 0..100 0 In % of box width
highTickMarkAlignment int 1..3 center
lowTickMarkLength num 0..100 0 In % of box width
lowTickMarkAlignment int 1..3 center
Examples
Description

The CandlestickChart() function is used to depict stock market prices. The four data series required for this in the ChartData() function correspond to the highest, lowest, closing and opening prices. The highest and lowest market price are connected by a line and the range between the opening and closing price by a rectangle. If the closing price is lower than the opening price, the rectangular area is filled, and vice-versa, if the closing price is higher than the opening price, the rectangular area is not filled by default. Bullish candlesticks can be filled, for example, with green by using the function CandlestickChartOptions() .

CANDLESTICK_CHART_01
1

OpenDrawing(250;​150)

2

ChartData(118 122 118 116 118 121 123;​ /* High-values.  */

3

102 105 104 104 110 111 113;​ /* Low-values.   */

4

104 119 118 108 115 118 113;​ /* Close-values. */

5

113 121 114 112 118 121 121) /* Open-values.  */

6

CandlestickChart()

7

/* Set up styles. */

8

FillStyle(1;​#4682b430)

9

BorderStyle(1;​;​0.5)

10

/* Set up axes. */

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up grid. */

14

MajorGridLineWidths(x;​y;​0.25)

15

MajorGridLineWidths(y;​x;​0)

16

CloseDrawing()

CANDLESTICK_CHART_01

The 1st argument appearanceConstants makes it possible to rotate the chart 90 degrees (appearanceConstants = horizontal) and to add shadow (appearanceConstants = shadow) to the candlesticks. The appearance constants can be combined by using a plus sign "+". The fill, border and shadow can be varied by using the style functions FillColorScheme() , FillStyle() , PictureStyle() , BorderColorScheme() , BorderStyle() and ShadowStyle() .

CANDLESTICK_CHART_02
1

OpenDrawing(250;​150)

2

ChartData(118 122 118 116 118 123;​ /* High-values.  */

3

102 105 104 104 110 113;​ /* Low-values.   */

4

104 119 118 108 115 113;​ /* Close-values. */

5

113 121 114 112 118 121) /* Open-values.  */

6

CandlestickChart(shadow+horizontal)

7

/* Set up styles. */

8

FillStyle(1;​#4682b430)

9

BorderStyle(1;​;​0.5)

10

ShadowStyle(all;​1 1 2)

11

/* Set up axes. */

12

ScalingOptions(y;​on) /* y-scale top to bottom. */

13

AxisLine(all;​0)

14

AxisMajorTicks(all;​0)

15

/* Set up grid. */

16

MajorGridLineWidths(x;​y;​0)

17

MajorGridLineWidths(y;​x;​0.25)

18

CloseDrawing()

CANDLESTICK_CHART_02

By using the 2nd argument itemGap, the distance between the individual candlesticks and the width of the rectangle can be controlled. The space should be entered in percent of the rectangle width. As the default, the space is equal to the rectangle width (itemGap =​ 100). For values greater than 100 (e.g. itemGap =​ 400) the rectangles are narrower and the spaces between them larger; for a value less than 100 (e.g. itemGap =​ 50) the rectangles are wider and the spaces smaller. As an option, markers can be added to the candlesticks. By using the 3rd and 4th argument highMarkerLength and highMarkerAlignment, the length and alignment of the markers for the highest values are defined; the 5th and 6th argument lowMarkerLength and lowMarkerAlignment are used to define the length and alignment of the markers for the lowest values. The length should be entered in percent of the rectangle width. The markers can be aligned to the left, to the right or centered (default).

CANDLESTICK_CHART_03
1

OpenDrawing(250;​150)

2

ChartData(118 122 125 116 126 121 123;​ /* High-values.  */

3

102 105 105 104 110 111 113;​ /* Low-values.  */

4

104 119 121 108 123 118 113;​ /* Close-values. */

5

113 121 114 112 113 121 121) /* Open-values.  */

6

CandlestickChart(;​300;​50;​right;​50;​left)

7

/* Set up styles. */

8

FillStyle(1;​#4682b430)

9

BorderStyle(1;​;​0.5)

10

/* Set up axes. */

11

AxisLine(all;​0)

12

AxisMajorTicks(all;​0)

13

/* Set up grid. */

14

MajorGridLineWidths(x;​y;​0.25)

15

MajorGridLineWidths(y;​x;​0)

16

CloseDrawing()

CANDLESTICK_CHART_03
CANDLESTICK_CHART_04
1

OpenDrawing(250;​150)

2

ChartData(10 10 10 10 10;​ /* High-values.  */

3

0 0 0 0 0;​ /* Low-values.   */

4

5 3 8 3 1;​ /* Close-values. */

5

2 9 7 5 1) /* Open-values.  */

6

CandlestickChart(horizontal;​60;​100;​center;​100;​center)

7

/* Set up styles. */

8

FillStyle(1;​#ca0d0050)

9

BorderStyle(1;​;​0.5)

10

/* Set up axes. */

11

ScalingOptions(y;​on) /* y-scale top to bottom. */

12

AxisLine(all;​0)

13

AxisMajorTicks(all;​0)

14

/* Set up grid. */

15

MajorGridLineWidths(x;​y;​0)

16

MajorGridLineWidths(y;​x;​0.25)

17

CloseDrawing()

CANDLESTICK_CHART_04

See also CandlestickChartOptions() .

Scroll to Top