TOS Horizontal Line


Category:
0
0

Hi Pete,

Just found your site, and wow, just wow….so very informative, thank you!

My question seems simple enough, but having never written any type code, I wonder how I might be able to put user defined horizontal lines on my charts w/o using the drawing tool as I’m doing now…that get deleted if I ever want to clear my drawing set to remove everything else, but not having to click on each one individually to avoid clearing all my horizontal support and resistance lines.

Something along the dashed lines on the attached chart that I added the horizontal lines with the drawing tool, but hopefully be able to enter them as a study that I could update with additional lines as I saw new ones develop, so I can clear my charts of all my other drawings with one click, and while still keeping the horizontal lines on the chart.

Thanks in advance for any thoughts, or help…and a special thanks for the great site,

Dave

PS. My apologies if this has already been asked and answered, but the only thing I could find that was close, was the “Horizontal Lines Ichimoku”, and I tried to find the “horizontal line” part of that formula, was just left me scratching my head as which code lines to copy, and try. =(

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on August 27, 2017 2:56 pm
6566 views
0
Private answer

The simple answer is that Thinkorswim does not permit us to write studies that can create or modify drawing tools. (the lines you draw manually are called drawing tools). The lines drawn by a chart study are called plots. The two have very different qualities.

It is possible to write a script that plots a single line on the chart:

plot theLine = 2450;

And you can add as many of those as you desire. So in some fashion, this may solve your question. But I suspect there is more to the story. Let us know.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on August 27, 2017 9:19 pm
0
Private answer

This will draw a line across the entire chart at the Price Line:

plot priceLine = Highestall(if IsNaN(close[-1]) then close else Double.NaN);

TOS tags it as a slow script, so I prefer doing this instead:

plot priceLine = if IsNaN(close[-1]) then close(period = aggregationPeriod.DAY) else Double.NaN;

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on January 9, 2018 10:46 am