Draw horizontal line into MT5 chart(s).

MT5.DrawHorizontalLine(
  sSymbol,
  fPrice,
  iWidth = 1,
  iColor = 1,
  sName = "",
  iTF = 0
)

Arguments

sSymbol

character; target symbol.

fPrice

numeric; at which price will be draw the line.

iWidth

int; which width will be draw the line (default 1).

iColor

int; See details (default 1: clrGreen).

sName

character; unique name if you want further modifications in lines parameters.

iTF

int; its always in minutes. If iTF = 0 it will be draw on all time frames (default 0). See details.

Value

Returns TRUE if the line was drawn, FALSE otherwise.

Details

Supported colors (iColor). See url below for even more details.

  • 1: clrGreen (GREEN)

  • 2: clrBlue (BLUE)

  • 3: clrRed (RED)

  • 4: clrNavy

  • 5: clrPurple

  • 6: clrIndigo

  • 7: clrOliveDrab

  • 8: clrDarkSlateBlue

  • 9: clrLawnGreen

  • 10: clrOrangeRed

  • 11: clrGold

  • 12: clrYellow

  • 13: clrAqua

  • 14: clrMagenta

  • 15: clrLightSlateGray

  • 16: clrPaleVioletRed

  • 17: clrHotPink

  • 18: clrKhaki

  • 19: clrSilver

  • 20: clrLightGray

  • 21: clrKhaki

  • 22: clrBeige

https://www.mql5.com/en/docs/constants/objectconstants/webcolors

Supported time frames (iTF). See url below for even more details.

  • 0: all (it will be draw on all time frames)

  • 1: PERIOD_M1

  • 2: PERIOD_M2

  • 5: PERIOD_M5

  • 15: PERIOD_M15

  • 30: PERIOD_M30

  • 60: PERIOD_H1

  • 120: PERIOD_H2

  • 240: PERIOD_H4

  • 480: PERIOD_H8

  • 1440: PERIOD_D1

  • 7200: PERIOD_W1

  • 216000: PERIOD_MN1

https://www.mql5.com/en/docs/constants/chartconstants/enum_timeframes

See also

Examples

if (FALSE) { # Red line in all EURUSD charts at 1.1772 MT5.DrawHorizontalLine("EURUSD", 1.1772, iColor = 3) }