drawText( text, location [, fgColor] [, flags])
The drawText() function is a simplified text drawing function that was introduced in EFS2. It accepts no barIndex parameter so it can only be used to draw text at the current bar offset.
Parameters
text
|
the symbol or text string to draw
|
location
|
see Location Flags below
|
fgColor
|
optional. the foreground color to use
|
flags
|
optional. see Text Flags below
|
Location Flags
TopRow1
|
draws at the upper margin of the chart
|
TopRow2
|
draws one row down from TopRow1
|
TopRow3
|
draws one row down from TopRow2
|
TopRow4
|
draws one row down from TopRow3
|
AboveBar1
|
draws directly above the high of the bar
|
AboveBar2
|
draws one row above AboveBar1
|
AboveBar3
|
draws one row above AboveBar2
|
AboveBar4
|
draws one row above AboveBar3
|
BelowBar1
|
draws directly below the low of the bar
|
BelowBar2
|
draws one row below BelowBar1
|
BelowBar3
|
draws one row below BelowBar2
|
BelowBar4
|
draws one row below BelowBar3
|
BottomRow1
|
draws at the lower margin of the chart
|
BottomRow2
|
draws one row above BottomRow1
|
BottomRow3
|
draws one row above BottomRow2
|
BottomRow4
|
draws one row above BottomRow3
|
Text Flags
Text.BOLD
|
display the text in bold
|
Text.ITALIC
|
display the text in italics
|
Text.UNDERLINE
|
underline the text
|
Text.PLAIN
|
display plain text
|
Note: Text flags can be ORed together to combine various attributes (e.g., Text.ITALIC | Text.BOLD | Text.UNDERLINE)
|
Usage
//draw the word "Buy" one row down from the low of the current bar
drawText( "Buy", BottomRow2 );
//draw the word "Sell" right above the high of the current bar
//color the text blue and display it with underline and bold attributes
drawText( "Sell", AboveBar1, Color.blue, Text.UNDERLINE | Text.BOLD );
drawTextRelative()
drawTextAbsolute()
drawTextPixel()
|