1

Is there a way to query the existence of a line.new? I have an indicator where I want to query whether a line has been drawn and if so what color the line has. Unfortunately I only found the query line.get_price in the documentation. The question is can I find out if a line was drawn by the indicator by querying the price. Likewise, the question of whether I through the query of

line.get_x1()
line.get_y1()
line.get_x2()
line.get_y2()

query whether the line was drawn or not? Or is there another way to query whether a line was drawn? Thanks for the help

Max
  • 19
  • 1

1 Answers1

0

You need to keep track of that yourself. You can use a user defined object with a bool variable.

type custom_line
    bool m_active = false
    line m_line = na

var my_line = custom_line.new()

if (line_add_condition)
    my_line.m_active := true
    my_line.m_line := line.new() // Create your line

// Check if the line was drawn
if (my_line.m_active)
    // Do stuff
vitruvius
  • 15,740
  • 3
  • 16
  • 26