Adjust vertical line: Thickness, Color, and Style


Hi Pete,

When using the code linked below to plot vertical lines, they appear on my charts as dotted lines.

Is it possible to augment the script so that when the study is double clicked the user is able to customize the following parameters (of the vertical line)

Color, Thickness, Syle (IE dashed dotted solid)


Plot vertical line at cross of SlowK and SlowD – Hahn-Tech, LLC

Marked as spam
Posted by (Questions: 7, Answers: 1)
Asked on September 17, 2022 2:13 pm
Thanks Pete! To refine this a bit, when I said double clicking, what i meant was like double clicking on the study itself (inside of the edit studies area). Then a window would open up where the user could change the color, thickness, style of that line that grets plotted. Thanks again!
( at September 17, 2022 5:00 pm)
The best you could achieve is to add a user input to the chart study which could be used to adjust the line style. You cannot change the thickness of any vertical line that is generated from a chart study. Then you could add a Global color setting to the chart study which would allow the color of the lines to be adjusted from the "Globals" section of the Edit Studies window.
( at September 17, 2022 5:24 pm)
Private answer

The "AddVerticalLine()" statement generates a plot on the chart from within a chart study.

There is no way to directly interact with, (such as double-click), plots generated by a chart study.

The language reference of Thinkorswim shows every detail about how the "AddVerticalLine()" statement can be implemented in a chart study:

Within that webpage you will see that AddVerticalLine() statement takes 4 parameters. The last two of those four control the color and the style. Those are the only two properties which can be adjusted and any parameters you include will be applied to all vertical lines which are added to the chart by that statement.

Marked as spam
Posted by (Questions: 37, Answers: 3891)
Answered on September 17, 2022 2:39 pm