Well perfection is the worst enemy of production. so I guess that my proposal could be quite good laugh

Anyway, I remember little regarding Mql, but if you change "double" with "var", fill the value in 2 "vars" named Close and LR_line, your code should work 90%.
You my encounter be the "vars Close" declaretion Close is a reserved name. Just use myClose or something like that. Try it and let me know.

Ciao