Adding text labels

Text labels could be added with the help of the following methods:

AddText(string tag, string text, bool isAbovePrice, int bar, decimal price, int yOffset, int xOffset, Color textColor,
                                      Color outlineColor, Color fillColor, float fontSize, DrawingText.TextAlign align, bool autoSize = false)
AddText(string tag, string text, bool isAbovePrice, int bar, decimal price, Color textColor,
                                      Color outlineColor, Color fillColor, float fontSize, DrawingText.TextAlign align, bool autoSize = false)
AddText(string tag, string text, bool isAbovePrice, int bar, decimal price, Color textColor, Color fillColor, float fontSize, DrawingText.TextAlign align, bool autoSize = false)

The passed parameters:

  • tag - a unique text identifier which is linked with a text mark
  • text - the displayed text
  • isAbovePrice - whether to display text over the price or not
  • bar - the number of the bar on which the text should be displayed
  • price - the price on which the text should be displayed
  • yOffset - an offset in pixels along the Y-axis
  • xOffset - an offset in pixels along the X-axis
  • textColor - the text colour
  • outlineColor - the colour of the frame around the text
  • fillColor - the colour of the text background
  • fontSize - the font size
  • align - text alignment (left, right or center)
  • autoSize - a flag which is responsible for activation of the dynamic text size depending on the chart scale

All three methods return the DrawingText object, in which parameters could be changed dynamically

Is this article helpful for you?