Drawing Horizontal S/R Lines
Author: Dave*Young
Creation Date: 9/15/2011 12:34 PM
profile picture

Dave*Young

#1
I'm finally trying some programming ! In searching through all the posts and the guides, I have not seen a way to draw a horizontal line, indicating support/resistance at a previous low/high. Preferably using some lookback period (XX), such as "the high for the last XX weeks/days".

Could someone suggest some code that could accomplish this simple task ?

Thanks in advance............
profile picture

Eugene

#2
profile picture

Dave*Young

#3
Eugene, Thanks for the timely response and link to the Wiki !

I had forgotten about the Wiki ? Looking back at the home page you find it at support/knowledge base. There is no obvious upfront link ? 'More reading to be done'

I loaded that code and played with it for awhile. It works great, but it annotates the bar 'NH' at many bars, with the last at [bar - 100]. So I just need to figure out how to assign a value to the high of the last 100 bar period. Then I can draw the 'one' Horizontal line.

Thanks Again
profile picture

Cone

#4
What's wrong with the Highest Indicator? It seems to precisely meet the requirements you've described except for "one" horizontal line. Why only "one"?

.. which is easy too.
CODE:
Please log in to see this code.
profile picture

Dave*Young

#5
Thanks again for the help with this.

I had the code in a loop and it drew multiple horizontal lines at each high.
The code I have now (still in the loop) is working fine and draws 'one' horizontal line for the high in a lookback period does the same for the low of that lookback period.

CODE:
Please log in to see this code.
profile picture

TrendCatcher

#6
It is not working. could you post the entire code here like in the link of Eugene's message above. thanks.

profile picture

Eugene

#7
The Wiki code sample for Highest undoubtedly works 100%.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).